@Test public void testGetInventoryNodeConnectorIdString() { String inventoryNodeId = "openflow:inventoryNodeId"; OvsdbTerminationPointAugmentation ovsdbTp = mock(OvsdbTerminationPointAugmentation.class); when(ovsdbTp.getOfport()).thenReturn(65534L); String result = InventoryHelper.getInventoryNodeConnectorIdString(inventoryNodeId, ovsdbTp, ovsdbTpIid, dataBroker); assertEquals("openflow:inventoryNodeId:65534", result); }
public static String getInventoryNodeConnectorIdString(String inventoryNodeId, OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker) { Long ofport = null; if (ovsdbTp.getOfport() != null && ovsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Invalid OpenFlow port {} for {}", ovsdbTp.getOfport(), ovsdbTp); return null; } if (ovsdbTp.getOfport() == null) { OvsdbTerminationPointAugmentation readOvsdbTp = getOvsdbTerminationPoint(tpIid, dataBroker); if (readOvsdbTp == null || readOvsdbTp.getOfport() == null || readOvsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Couldn't get OpenFlow port for {}", ovsdbTp); return null; } ofport = readOvsdbTp.getOfport(); } else { ofport = ovsdbTp.getOfport(); } String nodeConnectorIdString = inventoryNodeId + ":" + String.valueOf(ofport); if (StringUtils.countMatches(nodeConnectorIdString, ":") != 2) { LOG.error("{} is not correct format for NodeConnectorId.", nodeConnectorIdString); return null; } return nodeConnectorIdString; }
InventoryHelper { public static String getInventoryNodeConnectorIdString(String inventoryNodeId, OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker) { Long ofport = null; if (ovsdbTp.getOfport() != null && ovsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Invalid OpenFlow port {} for {}", ovsdbTp.getOfport(), ovsdbTp); return null; } if (ovsdbTp.getOfport() == null) { OvsdbTerminationPointAugmentation readOvsdbTp = getOvsdbTerminationPoint(tpIid, dataBroker); if (readOvsdbTp == null || readOvsdbTp.getOfport() == null || readOvsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Couldn't get OpenFlow port for {}", ovsdbTp); return null; } ofport = readOvsdbTp.getOfport(); } else { ofport = ovsdbTp.getOfport(); } String nodeConnectorIdString = inventoryNodeId + ":" + String.valueOf(ofport); if (StringUtils.countMatches(nodeConnectorIdString, ":") != 2) { LOG.error("{} is not correct format for NodeConnectorId.", nodeConnectorIdString); return null; } return nodeConnectorIdString; } }
InventoryHelper { public static String getInventoryNodeConnectorIdString(String inventoryNodeId, OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker) { Long ofport = null; if (ovsdbTp.getOfport() != null && ovsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Invalid OpenFlow port {} for {}", ovsdbTp.getOfport(), ovsdbTp); return null; } if (ovsdbTp.getOfport() == null) { OvsdbTerminationPointAugmentation readOvsdbTp = getOvsdbTerminationPoint(tpIid, dataBroker); if (readOvsdbTp == null || readOvsdbTp.getOfport() == null || readOvsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Couldn't get OpenFlow port for {}", ovsdbTp); return null; } ofport = readOvsdbTp.getOfport(); } else { ofport = ovsdbTp.getOfport(); } String nodeConnectorIdString = inventoryNodeId + ":" + String.valueOf(ofport); if (StringUtils.countMatches(nodeConnectorIdString, ":") != 2) { LOG.error("{} is not correct format for NodeConnectorId.", nodeConnectorIdString); return null; } return nodeConnectorIdString; }  }
InventoryHelper { public static String getInventoryNodeConnectorIdString(String inventoryNodeId, OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker) { Long ofport = null; if (ovsdbTp.getOfport() != null && ovsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Invalid OpenFlow port {} for {}", ovsdbTp.getOfport(), ovsdbTp); return null; } if (ovsdbTp.getOfport() == null) { OvsdbTerminationPointAugmentation readOvsdbTp = getOvsdbTerminationPoint(tpIid, dataBroker); if (readOvsdbTp == null || readOvsdbTp.getOfport() == null || readOvsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Couldn't get OpenFlow port for {}", ovsdbTp); return null; } ofport = readOvsdbTp.getOfport(); } else { ofport = ovsdbTp.getOfport(); } String nodeConnectorIdString = inventoryNodeId + ":" + String.valueOf(ofport); if (StringUtils.countMatches(nodeConnectorIdString, ":") != 2) { LOG.error("{} is not correct format for NodeConnectorId.", nodeConnectorIdString); return null; } return nodeConnectorIdString; }  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 getInventoryNodeConnectorIdString(String inventoryNodeId, OvsdbTerminationPointAugmentation ovsdbTp, InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker) { Long ofport = null; if (ovsdbTp.getOfport() != null && ovsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Invalid OpenFlow port {} for {}", ovsdbTp.getOfport(), ovsdbTp); return null; } if (ovsdbTp.getOfport() == null) { OvsdbTerminationPointAugmentation readOvsdbTp = getOvsdbTerminationPoint(tpIid, dataBroker); if (readOvsdbTp == null || readOvsdbTp.getOfport() == null || readOvsdbTp.getOfport() > MAX_OF_PORT) { LOG.debug("Couldn't get OpenFlow port for {}", ovsdbTp); return null; } ofport = readOvsdbTp.getOfport(); } else { ofport = ovsdbTp.getOfport(); } String nodeConnectorIdString = inventoryNodeId + ":" + String.valueOf(ofport); if (StringUtils.countMatches(nodeConnectorIdString, ":") != 2) { LOG.error("{} is not correct format for NodeConnectorId.", nodeConnectorIdString); return null; } return nodeConnectorIdString; }  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);  }