}
public static InstanceIdentifier<Node> createInstanceIdentifier(NodeId nodeId) {
- InstanceIdentifier<Node> nodePath = InstanceIdentifier
+ return InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
.child(Node.class,new NodeKey(nodeId));
- return nodePath;
}
public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key,OvsdbBridgeName bridgeName) {
public static NodeId createNodeId(IpAddress ip, PortNumber port) {
String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
- + new String(ip.getValue()) + ":" + port.getValue();
+ + String.valueOf(ip.getValue()) + ":" + port.getValue();
Uri uri = new Uri(uriString);
- NodeId nodeId = new NodeId(uri);
- return nodeId;
+ return new NodeId(uri);
}
public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
}
public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
- String datapathtype = new String(SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class));
-
- if (mdsalbridge.getDatapathType() != null) {
- if (SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()) != null) {
- datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
- } else {
- throw new IllegalArgumentException("Unknown datapath type "
- + SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()));
+ String datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class);
+
+ if (mdsalbridge.getDatapathType() != null && !mdsalbridge.getDatapathType().equals(DatapathTypeBase.class)) {
+ datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
+ if (datapathtype == null) {
+ throw new IllegalArgumentException("Unknown datapath type " + mdsalbridge.getDatapathType().getName());
}
}
return datapathtype;
}
public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
- Set<String> protocols = new HashSet<String>();
+ Set<String> protocols = new HashSet<>();
if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {