Allow terminationPoints to not need an interfaceType 15/20315/1
authorSam Hague <shague@redhat.com>
Thu, 14 May 2015 00:56:58 +0000 (20:56 -0400)
committerSam Hague <shague@redhat.com>
Thu, 14 May 2015 00:58:57 +0000 (00:58 +0000)
Change-Id: I3cb09cb16535fc5e23e3a5f976d0095a16208db2
Signed-off-by: Sam Hague <shague@redhat.com>
(cherry picked from commit 82fdc597e0aa3d66481432d91a18646ed1fde1b7)

southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java

index 48cf0159c3942fc746b53ec6ca5c4e93f0f738a1..d4ee1ac0bff06b6fabbcdf99323e4b0b212c02e4 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
 import org.opendaylight.ovsdb.southbound.SouthboundMapper;
+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.OvsdbPortInterfaceAttributes.VlanMode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
@@ -100,8 +101,8 @@ public class TerminationPointCreateCommand extends AbstractTransactCommand {
             final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
         ovsInterface.setName(terminationPoint.getName());
-        ovsInterface.setType(SouthboundMapper.createOvsdbInterfaceType(terminationPoint.getInterfaceType()));
 
+        createInterfaceType(terminationPoint, ovsInterface);
         createOfPort(terminationPoint, ovsInterface);
         createOfPortRequest(terminationPoint, ovsInterface);
         createInterfaceOptions(terminationPoint, ovsInterface);
@@ -109,6 +110,15 @@ public class TerminationPointCreateCommand extends AbstractTransactCommand {
         createInterfaceExternalIds(terminationPoint, ovsInterface);
     }
 
+    private void createInterfaceType(final OvsdbTerminationPointAugmentation terminationPoint,
+                                     final Interface ovsInterface) {
+
+        Class<? extends InterfaceTypeBase> mdsaltype = terminationPoint.getInterfaceType();
+        if (mdsaltype != null) {
+            ovsInterface.setType(SouthboundMapper.createOvsdbInterfaceType(mdsaltype));
+        }
+    }
+    
     private void createPort(
             final OvsdbTerminationPointAugmentation terminationPoint,
             final Port port, final String interfaceUuid) {