summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-04-09 13:56:45 -0400
committerDan Timoney <dtimoney@att.com>2020-04-13 14:32:10 -0400
commit83744b7572d30eca01bd122c798a9e9e5bd9353e (patch)
treef96aa777e9c591efa3ffc7ebfcc3d8bd9c51aacf
parentb970a7b46fac32e626acfa23b1e2de9b22da7ff7 (diff)
Add special handling for BGP RouteDistinguisher
Add special case code in MdsalHelper for BGP RouteDistinguisher class - a custom class implemented by OpenDaylight that does NOT follow the pattern of data object classes generated from Yang models by Yangtools Note: this depends on the following ccsdk/parent change to add OpenDaylight BGP dependencies to the dependencyManagement section of our parent poms: https://gerrit.onap.org/r/c/ccsdk/parent/+/105774 Change-Id: Ifebd03091d9ed9225e37c7242ecf7810abca1feb Issue-ID: CCSDK-2307 Signed-off-by: Dan Timoney <dtimoney@att.com>
-rwxr-xr-xsli/provider/pom.xml10
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java16
2 files changed, 24 insertions, 2 deletions
diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml
index 5dc327f1..056d748f 100755
--- a/sli/provider/pom.xml
+++ b/sli/provider/pom.xml
@@ -67,14 +67,22 @@
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
<artifactId>rfc6991</artifactId>
- </dependency>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.bgpcep</groupId>
+ <artifactId>bgp-concepts</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-core-api</artifactId>
+ <scope>provided</scope>
</dependency>
<!-- Testing Dependencies -->
<dependency>
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index 122c8862..d3ab6c33 100755
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -43,6 +43,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisherBuilder;
import org.opendaylight.yangtools.yang.binding.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -678,7 +680,19 @@ public class MdsalHelper {
+ "(" + paramValue + ")", e);
}
}
- } else {
+ } else if ("RouteDistinguisher".equals(simpleName)) {
+ if ((paramValue != null) && (paramValue.length() > 0)) {
+ try {
+ RouteDistinguisher routeDistinguisher = RouteDistinguisherBuilder.getDefaultInstance(paramValue);
+ m.invoke(toObj, routeDistinguisher);
+ foundValue = true;
+ } catch (Exception e) {
+ LOG.error("Caught exception calling " + toClass.getName() + "." + m.getName()
+ + "(" + paramValue + ")", e);
+ }
+ }
+ }
+ else {
// setter expects a yang-generated class. Need
// to
// create a builder to set it.