@Test public void testCreateTunnelPort_BridgeNull() { InstanceIdentifier<Node> nodeIid = InstanceIdentifier.create(Node.class); when(node.getAugmentation(OvsdbBridgeAugmentation.class)).thenReturn(null); OvsdbHelper.createTunnelPort(nodeIid, node, abstractTunnelType, dataBroker); verify(readWriteTransaction, never()).submit(); }
public static void createTunnelPort(InstanceIdentifier<Node> nodeIid, Node node, AbstractTunnelType tunnelType, DataBroker dataBroker) { OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge == null) { LOG.warn("No OvsdbBridgeAugmentationfor Node {}", node); return; } OvsdbNodeAugmentation managerNode = getManagerNode(bridge, dataBroker); if (managerNode == null) { LOG.warn("Couldn't create tunnel port for Node {}, no manager", node); return; } List<Options> options = tunnelType.getOptions(); OvsdbTerminationPointAugmentation ovsdbTp = buildOvsdbTerminationPointAugmentation(bridge, options, tunnelType); List<TerminationPoint> tps = buildTerminationPoints(bridge,ovsdbTp, tunnelType); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = buildOvsdbBridgeAugmentation(bridge,managerNode); Node configNode = getNode(node, tps,ovsdbBridgeAugmentation); LOG.info("About to write nodeId {} node {}",nodeIid,configNode); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); rwTx.merge(LogicalDatastoreType.CONFIGURATION, nodeIid, configNode); submitToDs(rwTx); }
OvsdbHelper { public static void createTunnelPort(InstanceIdentifier<Node> nodeIid, Node node, AbstractTunnelType tunnelType, DataBroker dataBroker) { OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge == null) { LOG.warn("No OvsdbBridgeAugmentationfor Node {}", node); return; } OvsdbNodeAugmentation managerNode = getManagerNode(bridge, dataBroker); if (managerNode == null) { LOG.warn("Couldn't create tunnel port for Node {}, no manager", node); return; } List<Options> options = tunnelType.getOptions(); OvsdbTerminationPointAugmentation ovsdbTp = buildOvsdbTerminationPointAugmentation(bridge, options, tunnelType); List<TerminationPoint> tps = buildTerminationPoints(bridge,ovsdbTp, tunnelType); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = buildOvsdbBridgeAugmentation(bridge,managerNode); Node configNode = getNode(node, tps,ovsdbBridgeAugmentation); LOG.info("About to write nodeId {} node {}",nodeIid,configNode); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); rwTx.merge(LogicalDatastoreType.CONFIGURATION, nodeIid, configNode); submitToDs(rwTx); } }
OvsdbHelper { public static void createTunnelPort(InstanceIdentifier<Node> nodeIid, Node node, AbstractTunnelType tunnelType, DataBroker dataBroker) { OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge == null) { LOG.warn("No OvsdbBridgeAugmentationfor Node {}", node); return; } OvsdbNodeAugmentation managerNode = getManagerNode(bridge, dataBroker); if (managerNode == null) { LOG.warn("Couldn't create tunnel port for Node {}, no manager", node); return; } List<Options> options = tunnelType.getOptions(); OvsdbTerminationPointAugmentation ovsdbTp = buildOvsdbTerminationPointAugmentation(bridge, options, tunnelType); List<TerminationPoint> tps = buildTerminationPoints(bridge,ovsdbTp, tunnelType); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = buildOvsdbBridgeAugmentation(bridge,managerNode); Node configNode = getNode(node, tps,ovsdbBridgeAugmentation); LOG.info("About to write nodeId {} node {}",nodeIid,configNode); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); rwTx.merge(LogicalDatastoreType.CONFIGURATION, nodeIid, configNode); submitToDs(rwTx); }  }
OvsdbHelper { public static void createTunnelPort(InstanceIdentifier<Node> nodeIid, Node node, AbstractTunnelType tunnelType, DataBroker dataBroker) { OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge == null) { LOG.warn("No OvsdbBridgeAugmentationfor Node {}", node); return; } OvsdbNodeAugmentation managerNode = getManagerNode(bridge, dataBroker); if (managerNode == null) { LOG.warn("Couldn't create tunnel port for Node {}, no manager", node); return; } List<Options> options = tunnelType.getOptions(); OvsdbTerminationPointAugmentation ovsdbTp = buildOvsdbTerminationPointAugmentation(bridge, options, tunnelType); List<TerminationPoint> tps = buildTerminationPoints(bridge,ovsdbTp, tunnelType); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = buildOvsdbBridgeAugmentation(bridge,managerNode); Node configNode = getNode(node, tps,ovsdbBridgeAugmentation); LOG.info("About to write nodeId {} node {}",nodeIid,configNode); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); rwTx.merge(LogicalDatastoreType.CONFIGURATION, nodeIid, configNode); submitToDs(rwTx); }  static OvsdbBridgeAugmentation getOvsdbBridgeFromTerminationPoint(
            InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker); static Node getNodeFromBridgeRef(OvsdbBridgeRef bridgeRef, DataBroker dataBroker); static OvsdbTerminationPointAugmentation getOvsdbTerminationPoint(
            InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker); static Node getNode(Node node, List<TerminationPoint> tps,
            OvsdbBridgeAugmentation ovsdbBridgeAugmentation); static OvsdbBridgeAugmentation buildOvsdbBridgeAugmentation(OvsdbBridgeAugmentation bridge,
            OvsdbNodeAugmentation ovsdbNode); static List<TerminationPoint> buildTerminationPoints(OvsdbBridgeAugmentation bridge,
            OvsdbTerminationPointAugmentation ovsdbTp, AbstractTunnelType tunnelType); static String generateTpName(OvsdbBridgeAugmentation bridge, AbstractTunnelType tunnelType); static OvsdbTerminationPointAugmentation buildOvsdbTerminationPointAugmentation(
            OvsdbBridgeAugmentation bridge, List<Options> options, AbstractTunnelType tunnelType); static void setOption(List<Options> options, String key, String value); static IpAddress getManagerIp(OvsdbNodeAugmentation ovsdbNode); static IpAddress getNodeIp(OvsdbNodeAugmentation ovsdbNode); static List<ControllerEntry> buildControllerEntries(IpAddress ip); static OvsdbNodeAugmentation getManagerNode(OvsdbBridgeAugmentation bridge, DataBroker dataBroker); static Node getTopologyNode(InstanceIdentifier<Node> nodeIid, DataBroker dataBroker); static void createTunnelPort(InstanceIdentifier<Node> nodeIid,
            Node node, AbstractTunnelType tunnelType, DataBroker dataBroker); }
OvsdbHelper { public static void createTunnelPort(InstanceIdentifier<Node> nodeIid, Node node, AbstractTunnelType tunnelType, DataBroker dataBroker) { OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class); if (bridge == null) { LOG.warn("No OvsdbBridgeAugmentationfor Node {}", node); return; } OvsdbNodeAugmentation managerNode = getManagerNode(bridge, dataBroker); if (managerNode == null) { LOG.warn("Couldn't create tunnel port for Node {}, no manager", node); return; } List<Options> options = tunnelType.getOptions(); OvsdbTerminationPointAugmentation ovsdbTp = buildOvsdbTerminationPointAugmentation(bridge, options, tunnelType); List<TerminationPoint> tps = buildTerminationPoints(bridge,ovsdbTp, tunnelType); OvsdbBridgeAugmentation ovsdbBridgeAugmentation = buildOvsdbBridgeAugmentation(bridge,managerNode); Node configNode = getNode(node, tps,ovsdbBridgeAugmentation); LOG.info("About to write nodeId {} node {}",nodeIid,configNode); ReadWriteTransaction rwTx = dataBroker.newReadWriteTransaction(); rwTx.merge(LogicalDatastoreType.CONFIGURATION, nodeIid, configNode); submitToDs(rwTx); }  static OvsdbBridgeAugmentation getOvsdbBridgeFromTerminationPoint(
            InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker); static Node getNodeFromBridgeRef(OvsdbBridgeRef bridgeRef, DataBroker dataBroker); static OvsdbTerminationPointAugmentation getOvsdbTerminationPoint(
            InstanceIdentifier<OvsdbTerminationPointAugmentation> tpIid, DataBroker dataBroker); static Node getNode(Node node, List<TerminationPoint> tps,
            OvsdbBridgeAugmentation ovsdbBridgeAugmentation); static OvsdbBridgeAugmentation buildOvsdbBridgeAugmentation(OvsdbBridgeAugmentation bridge,
            OvsdbNodeAugmentation ovsdbNode); static List<TerminationPoint> buildTerminationPoints(OvsdbBridgeAugmentation bridge,
            OvsdbTerminationPointAugmentation ovsdbTp, AbstractTunnelType tunnelType); static String generateTpName(OvsdbBridgeAugmentation bridge, AbstractTunnelType tunnelType); static OvsdbTerminationPointAugmentation buildOvsdbTerminationPointAugmentation(
            OvsdbBridgeAugmentation bridge, List<Options> options, AbstractTunnelType tunnelType); static void setOption(List<Options> options, String key, String value); static IpAddress getManagerIp(OvsdbNodeAugmentation ovsdbNode); static IpAddress getNodeIp(OvsdbNodeAugmentation ovsdbNode); static List<ControllerEntry> buildControllerEntries(IpAddress ip); static OvsdbNodeAugmentation getManagerNode(OvsdbBridgeAugmentation bridge, DataBroker dataBroker); static Node getTopologyNode(InstanceIdentifier<Node> nodeIid, DataBroker dataBroker); static void createTunnelPort(InstanceIdentifier<Node> nodeIid,
            Node node, AbstractTunnelType tunnelType, DataBroker dataBroker);  }