Merge "Avoid exceptions with IPv6 subnets"
authorFlavio Fernandes <ffernand@redhat.com>
Tue, 1 Dec 2015 13:54:17 +0000 (13:54 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 1 Dec 2015 13:54:17 +0000 (13:54 +0000)
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java
openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/workaround/NetvirtSfcWorkaroundOF13Provider.java
openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/workaround/services/SfcClassifierService.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/AbstractNeutronInterface.java
ovsdb-artifacts/pom.xml
resources/commons/Ovsdb-HwvtepSouthbound-Collection.json.postman_collection
utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java

index f5a65294c4dae0e1ca9bc61f62a3b433f8197ab6..31183ef5371850c3cdf27cd9625fd116c9ac8b2e 100644 (file)
@@ -23,7 +23,6 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configure
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 
-import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.Lists;
 
 import java.net.InetAddress;
@@ -32,7 +31,6 @@ import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.junit.Assert;
@@ -45,9 +43,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.openstack.netvirt.api.SecurityServicesManager;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
-import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.PipelineOrchestrator;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
@@ -59,11 +55,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeExternalIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder;
+
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.InterfaceTypeEntryBuilder;
@@ -299,7 +292,7 @@ public class NetvirtIT extends AbstractMdsalTestBase {
 
     /**
      * Test passive connection mode. The southbound starts in a listening mode waiting for connections on port
-     * 6640. This test will wait for incoming connections for {@link NetvirtITConstants.CONNECTION_INIT_TIMEOUT} ms.
+     * 6640. This test will wait for incoming connections for {@link NetvirtITConstants#CONNECTION_INIT_TIMEOUT} ms.
      *
      * @throws InterruptedException
      */
@@ -334,7 +327,7 @@ public class NetvirtIT extends AbstractMdsalTestBase {
     }
 
     private String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return String.valueOf(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     private boolean addOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
@@ -440,7 +433,7 @@ public class NetvirtIT extends AbstractMdsalTestBase {
                         } else if (tokens[0].equalsIgnoreCase("ptcp")) {
                             ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
                             if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-                                controllerIpStr = new String(connectionInfo.getLocalIp().getValue());
+                                controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
                                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
                                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
                             } else {
@@ -555,21 +548,6 @@ public class NetvirtIT extends AbstractMdsalTestBase {
         //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
     }
 
-    private void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
-                              final ConnectionInfo connectionInfo) {
-        InstanceIdentifier<Node> connectionNodePath = SouthboundMapper.createInstanceIdentifier(connectionInfo);
-        ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));
-    }
-
-    private List<ProtocolEntry> createMdsalProtocols() {
-        List<ProtocolEntry> protocolList = new ArrayList<>();
-        ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
-                SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
-        protocolList.add(new ProtocolEntryBuilder().
-                setProtocol(mapper.get("OpenFlow13")).build());
-        return protocolList;
-    }
-
     private OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() {
         OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder =
                 new OvsdbTerminationPointAugmentationBuilder();
@@ -601,83 +579,12 @@ public class NetvirtIT extends AbstractMdsalTestBase {
         return result;
     }
 
-    /*
-     * base method for adding test bridges.  Other helper methods used to create bridges should utilize this method.
-     *
-     * @param connectionInfo
-     * @param bridgeIid if passed null, one is created
-     * @param bridgeName cannot be null
-     * @param bridgeNodeId if passed null, one is created based on <code>bridgeIid</code>
-     * @param setProtocolEntries toggles whether default protocol entries are set for the bridge
-     * @param failMode toggles whether default fail mode is set for the bridge
-     * @param setManagedBy toggles whether to setManagedBy for the bridge
-     * @param dpType if passed null, this parameter is ignored
-     * @param externalIds if passed null, this parameter is ignored
-     * @param otherConfig if passed null, this parameter is ignored
-     * @return success of bridge addition
-     * @throws InterruptedException
-     */
-    private boolean addBridge(final ConnectionInfo connectionInfo, InstanceIdentifier<Node> bridgeIid,
-            final String bridgeName, NodeId bridgeNodeId, final boolean setProtocolEntries,
-            final Class<? extends OvsdbFailModeBase> failMode, final boolean setManagedBy,
-            final Class<? extends DatapathTypeBase> dpType,
-            final List<BridgeExternalIds> externalIds,
-            final List<BridgeOtherConfigs> otherConfigs) throws InterruptedException {
-
-        NodeBuilder bridgeNodeBuilder = new NodeBuilder();
-        if (bridgeIid == null) {
-            bridgeIid = SouthboundMapper.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
-        }
-        if (bridgeNodeId == null) {
-            bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
-        }
-        bridgeNodeBuilder.setNodeId(bridgeNodeId);
-        OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
-        ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
-        if (setProtocolEntries) {
-            ovsdbBridgeAugmentationBuilder.setProtocolEntry(createMdsalProtocols());
-        }
-        if (failMode != null) {
-            ovsdbBridgeAugmentationBuilder.setFailMode(failMode);
-        }
-        if (setManagedBy) {
-            setManagedBy(ovsdbBridgeAugmentationBuilder, connectionInfo);
-        }
-        if (dpType != null) {
-            ovsdbBridgeAugmentationBuilder.setDatapathType(dpType);
-        }
-        if (externalIds != null) {
-            ovsdbBridgeAugmentationBuilder.setBridgeExternalIds(externalIds);
-        }
-        if (otherConfigs != null) {
-            ovsdbBridgeAugmentationBuilder.setBridgeOtherConfigs(otherConfigs);
-        }
-        bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
-        LOG.debug("Built with the intent to store bridge data {}",
-                ovsdbBridgeAugmentationBuilder.toString());
-        boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
-                bridgeIid, bridgeNodeBuilder.build());
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    private boolean addBridge(final ConnectionInfo connectionInfo, final String bridgeName)
-        throws InterruptedException {
-
-        return addBridge(connectionInfo, null, bridgeName, null, true,
-                SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null, null);
-    }
-
-    private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo) {
-        return getBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
-    }
-
     /**
      * Extract the <code>store</code> type data store contents for the particular bridge identified by
      * <code>bridgeName</code>.
      *
-     * @param connectionInfo
-     * @param bridgeName
+     * @param connectionInfo The connection information.
+     * @param bridgeName The bridge name.
      * @param store defined by the <code>LogicalDatastoreType</code> enumeration
      * @return <code>store</code> type data store contents
      */
@@ -694,8 +601,8 @@ public class NetvirtIT extends AbstractMdsalTestBase {
      * extract the <code>LogicalDataStoreType.OPERATIONAL</code> type data store contents for the particular bridge
      * identified by <code>bridgeName</code>
      *
-     * @param connectionInfo
-     * @param bridgeName
+     * @param connectionInfo The connection information.
+     * @param bridgeName The bridge name.
      * @see <code>NetvirtIT.getBridge(ConnectionInfo, String, LogicalDatastoreType)</code>
      * @return <code>LogicalDatastoreType.OPERATIONAL</code> type data store contents
      */
@@ -707,8 +614,8 @@ public class NetvirtIT extends AbstractMdsalTestBase {
      * Extract the node contents from <code>store</code> type data store for the
      * bridge identified by <code>bridgeName</code>
      *
-     * @param connectionInfo
-     * @param bridgeName
+     * @param connectionInfo The connection information.
+     * @param bridgeName The bridge name.
      * @param store defined by the <code>LogicalDatastoreType</code> enumeration
      * @return <code>store</code> type data store contents
      */
@@ -719,22 +626,6 @@ public class NetvirtIT extends AbstractMdsalTestBase {
         return mdsalUtils.read(store, bridgeIid);
     }
 
-    /**
-     * Extract the node contents from <code>LogicalDataStoreType.OPERATIONAL</code> data store for the
-     * bridge identified by <code>bridgeName</code>
-     *
-     * @param connectionInfo
-     * @param bridgeName
-     * @return <code>LogicalDatastoreType.OPERATIONAL</code> type data store contents
-     */
-    private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName) {
-        return getBridgeNode(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL);
-    }
-
-    private boolean deleteBridge(ConnectionInfo connectionInfo) throws InterruptedException {
-        return deleteBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
-    }
-
     private boolean deleteBridge(final ConnectionInfo connectionInfo, final String bridgeName)
         throws InterruptedException {
 
index 7c7f43493c0dfd691cb1b74459d6b0b2fa34ddc2..b61be197bb18bbee2efc09d5231878f11da88ce8 100644 (file)
@@ -10,24 +10,16 @@ package org.opendaylight.ovsdb.openstack.netvirt.it;
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashSet;
-import java.util.Set;
 
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeSystem;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
@@ -40,10 +32,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableBiMap;
 
 public class SouthboundMapper {
     private static final Logger LOG = LoggerFactory.getLogger(SouthboundMapper.class);
@@ -125,91 +114,13 @@ public class SouthboundMapper {
 
     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);
         return new NodeId(uri);
     }
 
-    public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
-        if (ip.getIpv4Address() != null) {
-            return InetAddress.getByName(ip.getIpv4Address().getValue());
-        } else if (ip.getIpv6Address() != null) {
-            return InetAddress.getByName(ip.getIpv6Address().getValue());
-        } else {
-            throw new UnknownHostException("IP Address has no value");
-        }
-    }
-
-    public static DatapathId createDatapathId(Set<String> dpids) {
-        Preconditions.checkNotNull(dpids);
-        if (dpids.isEmpty()) {
-            return null;
-        } else {
-            String[] dpidArray = new String[dpids.size()];
-            dpids.toArray(dpidArray);
-            return createDatapathId(dpidArray[0]);
-        }
-    }
-
-    public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
-        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  Class<? extends DatapathTypeBase> createDatapathType(String type) {
-        Preconditions.checkNotNull(type);
-        if (type.isEmpty()) {
-            return DatapathTypeSystem.class;
-        } else {
-            ImmutableBiMap<String, Class<? extends DatapathTypeBase>> mapper =
-                    SouthboundConstants.DATAPATH_TYPE_MAP.inverse();
-            return mapper.get(type);
-        }
-    }
-
-    public static DatapathId createDatapathId(String dpid) {
-        Preconditions.checkNotNull(dpid);
-        DatapathId datapath;
-        if (dpid.matches("^[0-9a-fA-F]{16}")) {
-            Splitter splitter = Splitter.fixedLength(2);
-            Joiner joiner = Joiner.on(":");
-            datapath = new DatapathId(joiner.join(splitter.split(dpid)));
-        } else {
-            datapath = new DatapathId(dpid);
-        }
-        return datapath;
-    }
-
-    public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
-        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) {
-                    protocols.add(SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()));
-                } else {
-                    throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol());
-                }
-            }
-        }
-        return protocols;
-    }
-
     public static  Class<? extends InterfaceTypeBase> createInterfaceType(String type) {
         Preconditions.checkNotNull(type);
         return SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(type);
     }
-
-    public static String createOvsdbInterfaceType(Class<? extends InterfaceTypeBase> mdsaltype) {
-        Preconditions.checkNotNull(mdsaltype);
-        ImmutableBiMap<Class<? extends InterfaceTypeBase>, String> mapper =
-                SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.inverse();
-        return mapper.get(mdsaltype);
-    }
 }
index a69e801281e0794ac6c4e2f4502c8594e168e377..b3b43a6fdccb59e479be5e3cf2d4a76dbdbffa9d 100644 (file)
@@ -20,13 +20,11 @@ import org.opendaylight.ovsdb.openstack.netvirt.sfc.INetvirtSfcOF13Provider;
 import org.opendaylight.ovsdb.openstack.netvirt.sfc.ISfcClassifierService;
 import org.opendaylight.ovsdb.openstack.netvirt.sfc.NshUtils;
 import org.opendaylight.ovsdb.openstack.netvirt.sfc.SfcUtils;
-import org.opendaylight.ovsdb.southbound.SouthboundConstants;
 import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
 import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
 import org.opendaylight.sfc.provider.api.SfcProviderRenderedPathAPI;
 import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
 import org.opendaylight.sfc.provider.api.SfcProviderServiceFunctionAPI;
-import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.common.rev151017.SfName;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.data.plane.locator.locator.type.Ip;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInput;
 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.rsp.rev140701.CreateRenderedPathInputBuilder;
@@ -39,8 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sfp.rev1407
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.Ace;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.Matches;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.acl.rev150105.RedirectToSfc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.Classifier;
@@ -50,7 +46,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
 import org.osgi.framework.ServiceReference;
@@ -63,13 +58,9 @@ public class NetvirtSfcWorkaroundOF13Provider implements INetvirtSfcOF13Provider
     private volatile Southbound southbound;
     private volatile ISfcClassifierService sfcClassifierService;
     private static final short SFC_TABLE = 150;
-    private static final int GPE_PORT = 6633;
-    private static final String NETWORK_TYPE_VXLAN = "vxlan";
     private MdsalUtils mdsalUtils;
     private SfcUtils sfcUtils;
     private static final String VXGPE = "vxgpe";
-    private static final String TUNNEL_DST = "192.168.120.31";
-    private static final String TUNNEL_VNID = "10";
     public static final String TUNNEL_ENDPOINT_KEY = "local_ip";
 
     public NetvirtSfcWorkaroundOF13Provider(final DataBroker dataBroker, MdsalUtils mdsalUtils, SfcUtils sfcUtils) {
@@ -139,105 +130,6 @@ public class NetvirtSfcWorkaroundOF13Provider implements INetvirtSfcOF13Provider
         handleRenderedServicePath(rsp, entry);
     }
 
-    private void handleRenderedServicePathOld(RenderedServicePath rsp, Ace entry) {
-        LOG.info("handleRenderedServicePath: RSP: {}", rsp);
-
-        Matches matches = entry.getMatches();
-        if (matches == null) {
-            LOG.warn("processAclEntry: matches not found");
-            return;
-        }
-
-        List<RenderedServicePathHop> pathHopList = rsp.getRenderedServicePathHop();
-        if (pathHopList.isEmpty()) {
-            LOG.warn("handleRenderedServicePath: RSP {} has empty hops!!", rsp.getName());
-            return;
-        }
-        LOG.info("handleRenderedServicePath: pathHopList: {}", pathHopList);
-
-        final List<Node> bridgeNodes = nodeCacheManager.getBridgeNodes();
-        if (bridgeNodes == null || bridgeNodes.isEmpty()) {
-            LOG.warn("handleRenderedServicePath: There are no bridges to process");
-            return;
-        }
-        for (Node bridgeNode : bridgeNodes) {
-            OvsdbBridgeAugmentation ovsdbBridgeAugmentation = southbound.getBridge(bridgeNode, "br-int");
-            if (ovsdbBridgeAugmentation == null) {
-                continue;
-            }
-            long vxGpeOfPort = getOFPort(bridgeNode, VXGPE);
-            if (vxGpeOfPort == 0L) {
-                LOG.warn("programAclEntry: Could not identify tunnel port {} -> OF ({}) on {}",
-                        VXGPE, vxGpeOfPort, bridgeNode);
-                continue;
-            }
-            long dataPathId = southbound.getDataPathId(bridgeNode);
-            if (dataPathId == 0L) {
-                LOG.warn("programAclEntry: Could not identify datapathId on {}", bridgeNode);
-                continue;
-            }
-
-            // Find the first Hop within an RSP.
-            // The classifier flow needs to send all matched traffic to this first hop SFF.
-            RenderedServicePathFirstHop firstRspHop = SfcProviderRenderedPathAPI
-                    .readRenderedServicePathFirstHop(rsp.getName());
-
-            LOG.info("handleRenderedServicePath: firstRspHop: {}", firstRspHop);
-            LOG.debug("handleRenderedServicePath: First Hop IPAddress = {}, Port = {}",
-                    firstRspHop.getIp().getIpv4Address().getValue(),
-                    firstRspHop.getPort().getValue());
-
-            NshUtils nshHeader = new NshUtils();
-            nshHeader.setNshMetaC1(NshUtils.convertIpAddressToLong(new Ipv4Address(TUNNEL_DST)));
-            nshHeader.setNshMetaC2(Long.parseLong(TUNNEL_VNID)); // get from register //get from
-            nshHeader.setNshNsp(rsp.getPathId());
-
-            RenderedServicePathHop firstHop = pathHopList.get(0);
-            RenderedServicePathHop lastHop = pathHopList.get(pathHopList.size()-1);
-            ServiceFunction serviceFunction =
-                    SfcProviderServiceFunctionAPI.readServiceFunction(
-                            SfName.getDefaultInstance(firstHop.getServiceFunctionName().getValue()));
-            if (serviceFunction == null) {
-                LOG.warn("programAclEntry: Could not identify ServiceFunction {} on {}",
-                        firstHop.getServiceFunctionName().getValue(), bridgeNode);
-                continue;
-            }
-
-            nshHeader.setNshNsi(firstHop.getServiceIndex());
-            // workaround: bypass sff and got directly to sf
-            //nshHeader.setNshTunIpDst(firstRspHop.getIp().getIpv4Address());
-            IpAddress sfIpAddress = sfcUtils.getSfIpAddress(serviceFunction);
-            String sfDplName = sfcUtils.getSfDplName(serviceFunction);
-            //sfcUtils.getSfIp(firstHop.getServiceFunctionName().getValue());
-            nshHeader.setNshTunIpDst(sfIpAddress.getIpv4Address());
-            nshHeader.setNshTunUdpPort(firstRspHop.getPort());
-            LOG.debug("handleRenderedServicePath: NSH Header = {}", nshHeader);
-
-            sfcClassifierService.programIngressClassifier(dataPathId, entry.getRuleName(), matches,
-                    nshHeader, vxGpeOfPort, true);
-
-            sfcClassifierService.program_sfEgress(dataPathId, GPE_PORT, true);
-            long sfOfPort = getSfPort(bridgeNode, sfDplName);
-
-            String sfMac = getMacFromExternalIds(bridgeNode, sfDplName);
-            String sfIpString = new String(sfIpAddress.getValue());
-            LOG.info("handleRenderedServicePath: sfDplName: {}, sfMac: {}, sfOfPort: {}, sfIpAddress: {}",
-                    sfDplName, sfMac, sfOfPort, sfIpString);
-            if (sfMac != null) { // install if the sf is on this bridge, expand when using multiple bridges
-                sfcClassifierService.program_sfIngress(dataPathId, GPE_PORT, sfOfPort, sfIpString, sfDplName, true);
-                sfcClassifierService.programStaticArpEntry(dataPathId, 0L, sfMac, sfIpString, true);
-            }
-
-            short lastServiceindex = (short)((lastHop.getServiceIndex()).intValue() - 1);
-            sfcClassifierService.programEgressClassifier(dataPathId, vxGpeOfPort, rsp.getPathId(),
-                    lastServiceindex, sfOfPort, 0, true);
-            sfcClassifierService.programEgressClassifierBypass(dataPathId, vxGpeOfPort, rsp.getPathId(),
-                    lastServiceindex, sfOfPort, 0, true);
-
-            sfcClassifierService.programSfcTable(dataPathId, vxGpeOfPort, SFC_TABLE, true);
-        }
-    }
-
     private void handleRenderedServicePath(RenderedServicePath rsp, Ace entry) {
         LOG.info("handleRenderedServicePath: RSP: {}", rsp);
 
@@ -476,32 +368,8 @@ public class NetvirtSfcWorkaroundOF13Provider implements INetvirtSfcOF13Provider
         return rsp;
     }
 
-    // loop through all ports looking for vxlan types, skip vxgpe, keep the rest
-    // first pass we only have two tunnels: one for normal vxlan and the other for gpe
-    // so just return the first non-gpe vxlan port
-    private long getTunnelOfPort(Node bridgeNode, String vxGpePortName) {
-        long port = 0L;
-        List<OvsdbTerminationPointAugmentation> ovsdbTerminationPointAugmentations =
-                southbound.getTerminationPointsOfBridge(bridgeNode);
-        if (!ovsdbTerminationPointAugmentations.isEmpty()) {
-            for (OvsdbTerminationPointAugmentation terminationPointAugmentation :
-                    ovsdbTerminationPointAugmentations) {
-                if (terminationPointAugmentation.getInterfaceType() ==
-                        SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(NETWORK_TYPE_VXLAN)) {
-                    if (!terminationPointAugmentation.getName().equals(vxGpePortName)) {
-                        port = terminationPointAugmentation.getOfport();
-                        break;
-                    }
-                }
-            }
-        }
-        return port;
-    }
-
     private long getSfPort(Node bridgeNode, String sfPortName) {
-        long port = 0L;
-        port = getOFPort(bridgeNode, sfPortName);
-        return port;
+        return getOFPort(bridgeNode, sfPortName);
     }
 
     private long getOFPort(Node bridgeNode, String portName) {
@@ -514,14 +382,12 @@ public class NetvirtSfcWorkaroundOF13Provider implements INetvirtSfcOF13Provider
         if (ofPort == 0L) {
             for (int i = 0; i < 5; i++) {
                 LOG.info("Looking for ofPort {}, try: {}", portName, i);
-                if (ofPort == 0L) {
-                    TerminationPoint tp = southbound.readTerminationPoint(bridgeNode, null, portName);
-                    if (tp != null) {
-                        port = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
-                        if (port != null) {
-                            ofPort = southbound.getOFPort(port);
-                            break;
-                        }
+                TerminationPoint tp = southbound.readTerminationPoint(bridgeNode, null, portName);
+                if (tp != null) {
+                    port = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
+                    if (port != null) {
+                        ofPort = southbound.getOFPort(port);
+                        break;
                     }
                 }
                 try {
@@ -534,23 +400,6 @@ public class NetvirtSfcWorkaroundOF13Provider implements INetvirtSfcOF13Provider
         return ofPort;
     }
 
-    private String getMacFromOptions(Node bridgeNode, String portName) {
-        String mac = null;
-        OvsdbTerminationPointAugmentation port = southbound.extractTerminationPointAugmentation(bridgeNode, portName);
-        LOG.info("getMac: portName: {}, bridgeNode: {},,, port: {}", portName, bridgeNode, port);
-        if (port != null && port.getOptions() != null) {
-            //mac = southbound.getOptionsValue(port.getOptions(), EXTERNAL_ID_VM_MAC);
-            for (Options option : port.getOptions()) {
-                LOG.info("getMac: option: {}", option);
-                if (option.getOption().equals(Constants.EXTERNAL_ID_VM_MAC)) {
-                    mac = option.getValue();
-                    break;
-                }
-            }
-        }
-        return mac;
-    }
-
     private String getMacFromExternalIds(Node bridgeNode, String portName) {
         String mac = null;
         OvsdbTerminationPointAugmentation port = southbound.getTerminationPointOfBridge(bridgeNode, portName);
index 947dcec1f3d8211f94d7796df07e0985a468745f..8ebc06314b7c09fe3e360d9eb1ec3a54aa9a0412 100644 (file)
@@ -68,11 +68,8 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
 
     }
 
-    //private AtomicLong flowCookieInc = new AtomicLong(0x1L);
     private BigInteger getCookie(FlowID flowID) {
-        String cookieString = new String().format("1110%02d%010d", flowID.value, cookieIndex++);
-                //new String().format("1100%02d00%04d", flowID.value, flowCookieInc.getAndIncrement());
-                // "1100%02000000d%04d"
+        String cookieString = String.format("1110%02d%010d", flowID.value, cookieIndex++);
         return new BigInteger(cookieString, 16);
     }
 
@@ -217,25 +214,8 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
         if (write) {
             InstructionsBuilder isb = new InstructionsBuilder();
             List<Instruction> instructions = Lists.newArrayList();
-            InstructionBuilder ib = new InstructionBuilder();
-
-            /*List<Action> actionList = Lists.newArrayList();
-
-            ActionBuilder ab = new ActionBuilder();
-            ab.setAction(ActionUtils.nxMoveNshc2ToTunId());
-            ab.setOrder(0);
-            ab.setKey(new ActionKey(0));
-            actionList.add(ab.build());
-
-            ApplyActionsBuilder aab = new ApplyActionsBuilder();
-            aab.setAction(actionList);
-            ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
-            ib.setOrder(instructions.size());
-            ib.setKey(new InstructionKey(instructions.size()));
-            instructions.add(ib.build());*/
-
-            ib = InstructionUtils.createGotoTableInstructions(new InstructionBuilder(), getTable());
+            InstructionBuilder ib = InstructionUtils.createGotoTableInstructions(new InstructionBuilder(), getTable());
             ib.setOrder(instructions.size());
             ib.setKey(new InstructionKey(instructions.size()));
             instructions.add(ib.build());
@@ -471,7 +451,7 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
         flowBuilder.setCookie(new FlowCookie(getCookie(FlowID.FLOW_SFARP)));
         flowBuilder.setCookieMask(new FlowCookie(getCookie(FlowID.FLOW_SFARP)));
 
-        if (write == true) {
+        if (write) {
             InstructionBuilder ib = new InstructionBuilder();
             InstructionsBuilder isb = new InstructionsBuilder();
             List<Instruction> instructions = Lists.newArrayList();
@@ -547,8 +527,6 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
         // Build the Actions to Add the NSH Header
         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nshC1Load =
                 ActionUtils.nxLoadNshc1RegAction(header.getNshMetaC1());
-        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nshC2Load =
-                ActionUtils.nxLoadNshc2RegAction(header.getNshMetaC2());
         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nspLoad =
                 ActionUtils.nxSetNspAction(header.getNshNsp());
         org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action nsiLoad =
@@ -561,8 +539,6 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
         int count = actionList.size();
         actionList.add(new ActionBuilder()
                 .setKey(new ActionKey(count)).setOrder(count++).setAction(nshC1Load).build());
-        //actionList.add(new ActionBuilder()
-        // .setKey(new ActionKey(count)).setOrder(count++).setAction(nshC2Load).build());
         actionList.add(new ActionBuilder()
                 .setKey(new ActionKey(count)).setOrder(count++).setAction(nspLoad).build());
         actionList.add(new ActionBuilder()
@@ -580,16 +556,13 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
         if (matches.getAceType() instanceof AceIp) {
             AceIp aceIp = (AceIp)matches.getAceType();
             if (aceIp.getAceIpVersion() instanceof AceIpv4) {
-                //AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion();
-                //MatchUtils.createSrcL3IPv4Match(matchBuilder, aceIpv4.getSourceIpv4Network());
-                //MatchUtils.createDstL3IPv4Match(matchBuilder, aceIpv4.getDestinationIpv4Network());
                 MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol());
                 MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(), 0,
-                        aceIp.getDestinationPortRange().getLowerPort().getValue().intValue());
+                        aceIp.getDestinationPortRange().getLowerPort().getValue());
             } else {
                 MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol());
                 MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(), 0,
-                        aceIp.getDestinationPortRange().getLowerPort().getValue().intValue());
+                        aceIp.getDestinationPortRange().getLowerPort().getValue());
             }
         } else if (matches.getAceType() instanceof AceEth) {
             AceEth aceEth = (AceEth) matches.getAceType();
index 3a3ea5dc38847e92cf272340ded4d4327c8a09eb..d59f53601734280d497669f225369496a3d40f84 100644 (file)
@@ -561,7 +561,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                         } else if (tokens[0].equalsIgnoreCase("ptcp")) {
                             ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
                             if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-                                controllerIpStr = new String(connectionInfo.getLocalIp().getValue());
+                                controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
                                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
                                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
                             } else {
index 178a228f7aa3c7c82e07d7e6ab520fedb1b5d8aa..841e6bf7360d44e8a11a45eeec723ea920a26513 100644 (file)
@@ -55,17 +55,13 @@ public abstract class AbstractNeutronInterface<T extends DataObject, S extends I
 
     protected abstract T toMd(String uuid);
 
-    protected <T extends org.opendaylight.yangtools.yang.binding.DataObject> T readMd(InstanceIdentifier<T> path) {
-        T result = null;
+    protected <B extends org.opendaylight.yangtools.yang.binding.DataObject> B readMd(InstanceIdentifier<B> path) {
+        B result = null;
         final ReadOnlyTransaction transaction = getDataBroker().newReadOnlyTransaction();
-        CheckedFuture<Optional<T>, ReadFailedException> future = transaction.read(LogicalDatastoreType.CONFIGURATION, path);
+        CheckedFuture<Optional<B>, ReadFailedException> future = transaction.read(LogicalDatastoreType.CONFIGURATION, path);
         if (future != null) {
-            Optional<T> optional;
             try {
-                optional = future.checkedGet();
-                if (optional.isPresent()) {
-                    result = optional.get();
-                }
+                result = future.checkedGet().orNull();
             } catch (ReadFailedException e) {
                 LOGGER.warn("Failed to read {}", path, e);
             }
index 62b622c9777986544a6a7620f4d850a9068bc0ed..20e5f92e8da2c7d4a6468011c96b2b963d85c9fd 100644 (file)
@@ -11,6 +11,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
+  <parent>
+    <groupId>org.opendaylight.odlparent</groupId>
+    <artifactId>odlparent-lite</artifactId>
+    <version>1.6.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
   <groupId>org.opendaylight.ovsdb</groupId>
   <artifactId>ovsdb-artifacts</artifactId>
   <version>1.2.1-SNAPSHOT</version>
index 45fd82f5f1f9e5c1c2fed7421fefadd7fc4cdf44..262ec0f108e7baef66ea5da9f0f76636957144cd 100755 (executable)
@@ -9,6 +9,10 @@
         "6e7c88e4-485d-ab9f-4c3a-cc235e022905",
         "92ee7422-5b08-6d63-2b95-961ec0e18ffa",
         "e92ac963-daaf-0899-c3e8-a00d897be0e2",
+        "88789ac9-9de9-bab3-565b-307774e49f4d",
+        "e25f67e4-3a3f-5da7-f7c8-41b371156719",
+        "f7d33d50-7c8e-69e2-6d60-5c6155c5d210",
+        "233b5ab5-8177-4416-6912-2477520a0654",
         "9bc22ca7-049c-af51-7c12-6bf71044b2ec",
         "f6d300f7-380a-d090-0d4a-2b2ddefe5104",
         "f9f71d74-a49d-b190-d929-b6772ce0ba73",
@@ -16,7 +20,8 @@
         "22354294-1d01-cebf-180c-d609747be9bc",
         "c8e8f3fd-3bfb-aafa-e3ec-a671a942f426",
         "d362ddc4-1c5f-67d5-e354-c2a8d2ba9d79",
-        "538c71b3-e3e6-f01b-cc4c-d2b686686aa8"
+        "538c71b3-e3e6-f01b-cc4c-d2b686686aa8",
+        "a13e6877-997e-84e1-c8e8-e83ef5e9a002"
     ],
     "owner":0,
     "sharedWithTeam":false,
@@ -29,7 +34,7 @@
             "id":"18032e93-3bc5-9976-4525-fe1e77e98207",
             "name":"Delete Specific Config Logical Switch",
             "description":"This restconf request delete specific logical switch from the config data store.",
-            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%2Flogicalswitch%2Fls0",
+            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640/logical-switches/ls0",
             "method":"DELETE",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\n",
             "data":[],
             "id":"538c71b3-e3e6-f01b-cc4c-d2b686686aa8",
             "name":"Get Specific Operational Logical Switch",
             "description":"This restconf request fetch the operational for specific Logical Switch",
-            "url":"http://{{controllerHost}}:8181/restconf/operational/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%2logicalswitch%2ls0",
+            "url":"http://{{controllerHost}}:8181/restconf/operational/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640/logical-switches/ls0",
             "method":"GET",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\n",
-            "data":"{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/logicalswitch/ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"hwvtep-node-name\": \"ls0\",\n            \"tunnel-key\": \"10000\"\n        }\n    ]\n}",
+            "data":[],
             "dataMode":"raw",
             "timestamp":0,
             "version":2,
             "id":"9bc22ca7-049c-af51-7c12-6bf71044b2ec",
             "name":"Create Specific Config Logical Switch",
             "description":"Fire this Restconf request if you want to create a logical switch.",
-            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/",
+            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640",
             "method":"POST",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
-            "data":"{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/logicalswitch/ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"hwvtep-node-name\": \"ls0\",\n            \"tunnel-key\": \"10000\",\n            \"managed-by\": \"/network-topology:network-topology/network-topology:topology[network-topology:topology-id='hwvtep:1']/network-topology:node[network-topology:node-id='hwvtep://{{hwvtepNodeIp}}:6640']\"             \n        }\n    ]\n}",
+            "data":"{\n  \"logical-switches\": [\n        {\n            \"hwvtep-node-name\": \"ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"tunnel-key\": \"10000\"\n         }\n    ]\n}",
             "dataMode":"raw",
             "timestamp":0,
             "version":2,
             "url":"http://{{controllerHost}}:8181/restconf/operational/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640",
             "method":"GET",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\n",
-            "data":"{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/logicalswitch/ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"hwvtep-node-name\": \"ls0\",\n            \"tunnel-key\": \"10000\"\n        }\n    ]\n}",
+            "data":[],
             "dataMode":"raw",
             "timestamp":0,
             "version":2,
         {
             "collectionId":"19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
             "id":"f6d300f7-380a-d090-0d4a-2b2ddefe5104",
-            "name":"Create Specific Config Logical Switch",
+            "name":"Update Specific Config Logical Switch",
             "description":"Fire this request if you want to update specific logical switch.",
-            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%2Flogicalswitch%2Fls0",
+            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640/logical-switches/ls0",
             "method":"PUT",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
-            "data":"{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/logicalswitch/ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"hwvtep-node-name\": \"ls0\",\n            \"tunnel-key\": \"10000\",\n            \"managed-by\": \"/network-topology:network-topology/network-topology:topology[network-topology:topology-id='hwvtep:1']/network-topology:node[network-topology:node-id='hwvtep://{{hwvtepNodeIp}}:6640']\"             \n        }\n    ]\n}",
+            "data":"{\n  \"logical-switches\": [\n        {\n            \"hwvtep-node-name\": \"ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"tunnel-key\": \"10000\"\n         }\n    ]\n}",
             "dataMode":"raw",
             "timestamp":0,
             "version":2,
             "id":"f9f71d74-a49d-b190-d929-b6772ce0ba73",
             "name":"Get Specific Config Logical Switch",
             "description":"This restconf request fetch configuration for specific logical switch.",
-            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%2Flogicalswitch%2Fls0",
+            "url":"http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640/logical-switches/ls0",
             "method":"GET",
             "headers":"Authorization: Basic YWRtaW46YWRtaW4=\n",
-            "data":"{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/logicalswitch/ls0\",\n            \"hwvtep-node-description\": \"\",\n            \"hwvtep-node-name\": \"ls0\",\n            \"tunnel-key\": \"10000\"\n        }\n    ]\n}",
+            "data":[],
             "dataMode":"raw",
             "timestamp":0,
             "version":2,
             "time":1447335408595
+        },
+        {
+            "collectionId": "19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
+            "id": "88789ac9-9de9-bab3-565b-307774e49f4d",
+            "name": "Create Specific Config Physical Switch",
+            "description": "Fire this Restconf request if you want to create a physical switch.",
+            "url": "http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/",
+            "method": "POST",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+            "data": [],
+            "dataMode": "raw",
+            "timestamp": 0,
+            "version": 2,
+            "time": 1447909152443,
+            "preRequestScript": "",
+            "tests": "",
+            "rawModeData": "{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/physicalswitch/ps0\",\n            \"hwvtep-node-name\": \"ps0\",\n            \"hwvtep-node-description\": \"\",\n            \"management-ips\": [\n              {\n                \"management-ips-key\": \"{{managementIp}}\"\n              }\n            ],\n            \"tunnel-ips\": [\n              {\n                \"tunnel-ips-key\": \"{{tunnleIp}}\"\n              }\n            ],\n            \"managed-by\": \"/network-topology:network-topology/network-topology:topology[network-topology:topology-id='hwvtep:1']/network-topology:node[network-topology:node-id='hwvtep://{{hwvtepNodeIp}}:6640']\"             \n        }\n    ]\n}"
+        },
+        {
+            "collectionId": "19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
+            "id": "e25f67e4-3a3f-5da7-f7c8-41b371156719",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+            "url": "http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%phsicalswitch%2Fps0",
+            "preRequestScript": "",
+            "pathVariables": {},
+            "method": "PUT",
+            "data": [],
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "currentHelper": "normal",
+            "helperAttributes": {},
+            "time": 1448552632013,
+            "name": "Update Specific Config Physical Switch",
+            "description": "Fire this Restconf request if you want to update a exsiting physical switch.",
+            "rawModeData": "{\n  \"network-topology:node\": [\n        {\n            \"node-id\": \"hwvtep://{{hwvtepNodeIp}}:6640/physicalswitch/ps0\",\n            \"hwvtep-node-name\": \"ps0\",\n            \"hwvtep-node-description\": \"\",\n            \"management-ips\": [\n              {\n                \"management-ips-key\": \"{{managementIp}}\"\n              }\n            ],\n            \"tunnel-ips\": [\n              {\n                \"tunnel-ips-key\": \"{{tunnleIp}}\"\n              }\n            ],\n            \"managed-by\": \"/network-topology:network-topology/network-topology:topology[network-topology:topology-id='hwvtep:1']/network-topology:node[network-topology:node-id='hwvtep://{{hwvtepNodeIp}}:6640']\"             \n        }\n    ]\n}"
+        },
+        {
+            "collectionId": "19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
+            "id": "f7d33d50-7c8e-69e2-6d60-5c6155c5d210",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+            "url": "http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%phsicalswitch%2Fps0",
+            "preRequestScript": "",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "currentHelper": "normal",
+            "helperAttributes": {},
+            "time": 1448548819543,
+            "name": "Get Specific Config Physical Switch",
+            "description": "Fire this Restconf request if you want to get a exsiting physical switch."
+        },
+        {
+            "collectionId": "19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
+            "id": "233b5ab5-8177-4416-6912-2477520a0654",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nContent-Type: application/json\n",
+            "url": "http://{{controllerHost}}:8181/restconf/config/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%phsicalswitch%2Fps0",
+            "preRequestScript": "",
+            "pathVariables": {},
+            "method": "DELETE",
+            "data": [],
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "currentHelper": "normal",
+            "helperAttributes": {},
+            "time": 1448552707318,
+            "name": "Delete Specific Config Physical Switch",
+            "description": "Fire this Restconf request if you want to delete a physical switch.",
+            "rawModeData": ""
+        },
+        {
+            "collectionId": "19f6b1a8-4d54-62f8-6bd6-f52e0b6e40b8",
+            "id": "a13e6877-997e-84e1-c8e8-e83ef5e9a002",
+            "name": "Get Specific Operational Physical Switch",
+            "description": "",
+            "url": "http://{{controllerHost}}:8181/restconf/operational/network-topology:network-topology/topology/hwvtep:1/node/hwvtep:%2F%2F{{hwvtepNodeIp}}:6640%2Fphysicalswitch%2Fps0",
+            "method": "GET",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\n",
+            "data": [],
+            "dataMode": "raw",
+            "timestamp": 0,
+            "responses": [],
+            "version": 2,
+            "preRequestScript": "",
+            "tests": "",
+            "rawModeData": ""
         }
     ]
 }
index 9111acc92e35f5b81e5b8e7873461039f6d52bfa..978c5223b5384d2c8a330abc6c4bc6885742d1e6 100644 (file)
@@ -86,7 +86,7 @@ public class SouthboundUtils {
 
     public 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);
         return new NodeId(uri);
     }
@@ -168,7 +168,8 @@ public class SouthboundUtils {
     }
 
     public String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return String.valueOf(
+                connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     public boolean addOvsdbNode(final ConnectionInfo connectionInfo) {