@Test public void testGetInventoryNodeIdString() throws Exception { OvsdbBridgeAugmentation ovsdbBridge = mock(OvsdbBridgeAugmentation.class); DatapathId datapathId = mock(DatapathId.class); when(ovsdbBridge.getDatapathId()).thenReturn(datapathId); when(datapathId.getValue()).thenReturn("FF:FF:FF:FF:FF:FF:FF:FF"); String result = InventoryHelper.getInventoryNodeIdString(ovsdbBridge, ovsdbTpIid, dataBroker); assertEquals("openflow:281474976710655", result); }
public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; }
InventoryHelper { public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; } }
InventoryHelper { public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; }  }
InventoryHelper { public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; }  static Long getLongFromDpid(String dpid); static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge,
            InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker); static String getInventoryNodeConnectorIdString(String inventoryNodeId,
            OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid,
            DataBroker dataBroker); static boolean checkOfOverlayConfig(String nodeIdString, List<AbstractTunnelType> requiredTunnelTypes,
            DataBroker dataBroker); static InstanceIdentifier<ExternalInterfaces> addOfOverlayExternalPort(NodeId nodeId, NodeConnectorId ncId,
        DataBroker dataBroker); static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker); static void updateOfOverlayConfig(IpAddress ip, String nodeIdString, String nodeConnectorIdString,
            AbstractTunnelType tunnelType, DataBroker dataBroker); static void removeTunnelsOfOverlayConfig(String nodeIdString,
                                                    List<AbstractTunnelType> tunnels,
                                                    DataBroker dataBroker); }
InventoryHelper { public static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge, InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker) { DatapathId dpid = ovsdbBridge.getDatapathId(); if (dpid == null) { OvsdbBridgeAugmentation bridgeData = getOvsdbBridgeFromTerminationPoint(ovsdbTpIid, dataBroker); dpid = bridgeData.getDatapathId(); if (dpid == null) { LOG.error("No Data Path ID for OVSDB Bridge {}", ovsdbBridge); return null; } } Long macLong = getLongFromDpid(ovsdbBridge.getDatapathId().getValue()); String nodeIdString = "openflow:" + String.valueOf(macLong); if (StringUtils.countMatches(nodeIdString, ":") != 1) { LOG.error("{} is not correct format for NodeId.", nodeIdString); return null; } return nodeIdString; }  static Long getLongFromDpid(String dpid); static String getInventoryNodeIdString(OvsdbBridgeAugmentation ovsdbBridge,
            InstanceIdentifier<OvsdbTerminationPointAugmentation> ovsdbTpIid, DataBroker dataBroker); static String getInventoryNodeConnectorIdString(String inventoryNodeId,
            OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid,
            DataBroker dataBroker); static boolean checkOfOverlayConfig(String nodeIdString, List<AbstractTunnelType> requiredTunnelTypes,
            DataBroker dataBroker); static InstanceIdentifier<ExternalInterfaces> addOfOverlayExternalPort(NodeId nodeId, NodeConnectorId ncId,
        DataBroker dataBroker); static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker); static void updateOfOverlayConfig(IpAddress ip, String nodeIdString, String nodeConnectorIdString,
            AbstractTunnelType tunnelType, DataBroker dataBroker); static void removeTunnelsOfOverlayConfig(String nodeIdString,
                                                    List<AbstractTunnelType> tunnels,
                                                    DataBroker dataBroker);  }