Committed by
Gerrit Code Review
Fix NPE if flowSpecCapability is not specified
Change-Id: Iac5958cdbcd495f3b661771628de429eb2a07556
Showing
1 changed file
with
22 additions
and
14 deletions
... | @@ -128,14 +128,18 @@ public class BgpCfgProvider extends AbstractProvider { | ... | @@ -128,14 +128,18 @@ public class BgpCfgProvider extends AbstractProvider { |
128 | bgpConfig.setMaxSession(config.maxSession()); | 128 | bgpConfig.setMaxSession(config.maxSession()); |
129 | bgpConfig.setLargeASCapability(config.largeAsCapability()); | 129 | bgpConfig.setLargeASCapability(config.largeAsCapability()); |
130 | 130 | ||
131 | - if (config.flowSpecCapability().equals("IPV4")) { | 131 | + if (config.flowSpecCapability() == null) { |
132 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4); | ||
133 | - } else if (config.flowSpecCapability().equals("VPNV4")) { | ||
134 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.VPNV4); | ||
135 | - } else if (config.flowSpecCapability().equals("IPV4_VPNV4")) { | ||
136 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4_VPNV4); | ||
137 | - } else { | ||
138 | bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); | 132 | bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); |
133 | + } else { | ||
134 | + if (config.flowSpecCapability().equals("IPV4")) { | ||
135 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4); | ||
136 | + } else if (config.flowSpecCapability().equals("VPNV4")) { | ||
137 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.VPNV4); | ||
138 | + } else if (config.flowSpecCapability().equals("IPV4_VPNV4")) { | ||
139 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4_VPNV4); | ||
140 | + } else { | ||
141 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); | ||
142 | + } | ||
139 | } | 143 | } |
140 | bgpConfig.setFlowSpecRpdCapability(config.rpdCapability()); | 144 | bgpConfig.setFlowSpecRpdCapability(config.rpdCapability()); |
141 | 145 | ||
... | @@ -178,14 +182,18 @@ public class BgpCfgProvider extends AbstractProvider { | ... | @@ -178,14 +182,18 @@ public class BgpCfgProvider extends AbstractProvider { |
178 | bgpConfig.setMaxSession(config.maxSession()); | 182 | bgpConfig.setMaxSession(config.maxSession()); |
179 | bgpConfig.setLargeASCapability(config.largeAsCapability()); | 183 | bgpConfig.setLargeASCapability(config.largeAsCapability()); |
180 | 184 | ||
181 | - if (config.flowSpecCapability().equals("IPV4")) { | 185 | + if (config.flowSpecCapability() == null) { |
182 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4); | ||
183 | - } else if (config.flowSpecCapability().equals("VPNV4")) { | ||
184 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.VPNV4); | ||
185 | - } else if (config.flowSpecCapability().equals("IPV4_VPNV4")) { | ||
186 | - bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4_VPNV4); | ||
187 | - } else { | ||
188 | bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); | 186 | bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); |
187 | + } else { | ||
188 | + if (config.flowSpecCapability().equals("IPV4")) { | ||
189 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4); | ||
190 | + } else if (config.flowSpecCapability().equals("VPNV4")) { | ||
191 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.VPNV4); | ||
192 | + } else if (config.flowSpecCapability().equals("IPV4_VPNV4")) { | ||
193 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.IPV4_VPNV4); | ||
194 | + } else { | ||
195 | + bgpConfig.setFlowSpecCapability(BgpCfg.FlowSpec.NONE); | ||
196 | + } | ||
189 | } | 197 | } |
190 | bgpConfig.setFlowSpecRpdCapability(config.rpdCapability()); | 198 | bgpConfig.setFlowSpecRpdCapability(config.rpdCapability()); |
191 | 199 | ... | ... |
-
Please register or login to post a comment