[ONOS-8036] BGP-LS has only partial support for IPv6
- Removed hard-coded Ipv4Address and replaced with the generic
IpAddress wherever necessary
- Added support of AFI = 2 (IPv6) in MPReachNlri and MPUnreachNlri
- Added a new config parameter for IPv6 in BGP Config. This allows
AFI = 2 to be sent in BGP Open messages
- Skipped TLV 1170 and 1173, which were causing exceptions
Change-Id: I76e69021b1d2687754bbf700681070051e347942
diff --git a/providers/bgp/cfg/src/main/java/org/onosproject/provider/bgp/cfg/impl/BgpCfgProvider.java b/providers/bgp/cfg/src/main/java/org/onosproject/provider/bgp/cfg/impl/BgpCfgProvider.java
index c35f4f0..d9268d8 100644
--- a/providers/bgp/cfg/src/main/java/org/onosproject/provider/bgp/cfg/impl/BgpCfgProvider.java
+++ b/providers/bgp/cfg/src/main/java/org/onosproject/provider/bgp/cfg/impl/BgpCfgProvider.java
@@ -152,6 +152,8 @@
bgpConfig.connectPeer(nodes.get(i).hostname());
}
}
+
+ bgpConfig.setConnectionType(getBgpConnectionTypeFromConfig(config));
}
/**
@@ -259,6 +261,30 @@
}
}
+ bgpConfig.setConnectionType(getBgpConnectionTypeFromConfig(config));
+ }
+
+ /**
+ * Function to get Bgp Connection type from config.
+ * @param config The BgpAppConfig from which connection type is to be fetched
+ * @return Bgp connection type
+ */
+ private BgpCfg.ConnectionType getBgpConnectionTypeFromConfig(BgpAppConfig config) {
+ //config cannot be null here, because of the function call sequence
+
+ //But, let's put a sanity check for connectionType
+ if (null == config.connectionType()) {
+ //IPv4 is the default connection type
+ return BgpCfg.ConnectionType.IPV4;
+ }
+
+ if (config.connectionType().equals(BgpAppConfig.CONNECTION_TYPE_IPV4)) {
+ return BgpCfg.ConnectionType.IPV6;
+ } else if (config.connectionType().equals(BgpAppConfig.CONNECTION_TYPE_IPV4_AND_IPV6)) {
+ return BgpCfg.ConnectionType.IPV4_IPV6;
+ } else {
+ return BgpCfg.ConnectionType.IPV4;
+ }
}
/**