@SuppressWarnings("unchecked") @Test public void testGetOfOverlayConfig() throws Exception { when(writeTransaction.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))) .thenReturn(nodeConfigFuture); when(nodeConfigOptional.isPresent()).thenReturn(true); OfOverlayNodeConfig overlayConfig = mock(OfOverlayNodeConfig.class); when(nodeConfigOptional.get()).thenReturn(overlayConfig); assertEquals(overlayConfig, InventoryHelper.getOfOverlayConfig(nodeIdString, dataBroker)); }
public static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker) { InstanceIdentifier<OfOverlayNodeConfig> ofOverlayNodeIid = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeIdString))) .augmentation(OfOverlayNodeConfig.class) .build(); ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<OfOverlayNodeConfig> overlayConfig = readFromDs(LogicalDatastoreType.CONFIGURATION, ofOverlayNodeIid, transaction); if (overlayConfig.isPresent()) { return overlayConfig.get(); } return null; }
InventoryHelper { public static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker) { InstanceIdentifier<OfOverlayNodeConfig> ofOverlayNodeIid = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeIdString))) .augmentation(OfOverlayNodeConfig.class) .build(); ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<OfOverlayNodeConfig> overlayConfig = readFromDs(LogicalDatastoreType.CONFIGURATION, ofOverlayNodeIid, transaction); if (overlayConfig.isPresent()) { return overlayConfig.get(); } return null; } }
InventoryHelper { public static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker) { InstanceIdentifier<OfOverlayNodeConfig> ofOverlayNodeIid = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeIdString))) .augmentation(OfOverlayNodeConfig.class) .build(); ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<OfOverlayNodeConfig> overlayConfig = readFromDs(LogicalDatastoreType.CONFIGURATION, ofOverlayNodeIid, transaction); if (overlayConfig.isPresent()) { return overlayConfig.get(); } return null; }  }
InventoryHelper { public static OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker) { InstanceIdentifier<OfOverlayNodeConfig> ofOverlayNodeIid = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeIdString))) .augmentation(OfOverlayNodeConfig.class) .build(); ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<OfOverlayNodeConfig> overlayConfig = readFromDs(LogicalDatastoreType.CONFIGURATION, ofOverlayNodeIid, transaction); if (overlayConfig.isPresent()) { return overlayConfig.get(); } return null; }  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 OfOverlayNodeConfig getOfOverlayConfig(String nodeIdString, DataBroker dataBroker) { InstanceIdentifier<OfOverlayNodeConfig> ofOverlayNodeIid = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(nodeIdString))) .augmentation(OfOverlayNodeConfig.class) .build(); ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction(); Optional<OfOverlayNodeConfig> overlayConfig = readFromDs(LogicalDatastoreType.CONFIGURATION, ofOverlayNodeIid, transaction); if (overlayConfig.isPresent()) { return overlayConfig.get(); } return null; }  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);  }