Changes to LogicalSwitchUpdateCommand in transact as per new yang 07/30207/4
authorPeng Zhang <pzhang@ctbri.com.cn>
Wed, 25 Nov 2015 08:22:06 +0000 (16:22 +0800)
committerVishal Thapar <vishal.thapar@ericsson.com>
Thu, 26 Nov 2015 13:24:13 +0000 (18:54 +0530)
1. changes to LogicalSwitchUpdateCommand in transact
2. remove redundant code

PatchSet 2:
1. Get "extractCreated" back

PatchSet 3:
1. Change postman collection as per new yang

Patchset 4:
Fixed update issue in LogicalSwitchUpdate command

Change-Id: If2f34ed570bfa0f265c976178272dc07674766ec
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/PhysicalLocatorUpdateCommand.java
resources/commons/Ovsdb-HwvtepSouthbound-Collection.json.postman_collection

index b9bdec1149deb0d72158c126de7c81b5e90b848a..baf439e50904dcd2e860b221718dddea63505d86 100644 (file)
@@ -10,15 +10,14 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.transact;
 
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -26,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet;
 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;
@@ -43,8 +43,7 @@ public class HwvtepOperationalState {
     public HwvtepOperationalState(DataBroker db, Collection<DataTreeModification<Node>> changes) {
         ReadOnlyTransaction transaction = db.newReadOnlyTransaction();
         Map<InstanceIdentifier<Node>, Node> nodeCreateOrUpdate =
-            extractCreatedOrUpdatedOrRemoved(changes, Node.class);
-            //TransactUtils.extractCreatedOrUpdatedOrRemoved(changes, Node.class);
+            TransactUtils.extractCreatedOrUpdatedOrRemoved(changes, Node.class);
         if (nodeCreateOrUpdate != null) {
             for (Entry<InstanceIdentifier<Node>, Node> entry: nodeCreateOrUpdate.entrySet()) {
                 CheckedFuture<Optional<Node>, ReadFailedException> nodeFuture =
@@ -62,85 +61,23 @@ public class HwvtepOperationalState {
         transaction.close();
     }
 
-    private Node getCreated(DataObjectModification<Node> mod) {
-        if((mod.getModificationType() == ModificationType.WRITE)
-                        && (mod.getDataBefore() == null)){
-            return mod.getDataAfter();
-        }
-        return null;
-    }
-
-    private Node getRemoved(DataObjectModification<Node> mod) {
-        if(mod.getModificationType() == ModificationType.DELETE){
-            return mod.getDataBefore();
-        }
-        return null;
-    }
-
-    private Node getUpdated(DataObjectModification<Node> mod) {
-        Node node = null;
-        switch(mod.getModificationType()) {
-            case SUBTREE_MODIFIED:
-                node = mod.getDataAfter();
-                break;
-            case WRITE:
-                if(mod.getDataBefore() !=  null) {
-                    node = mod.getDataAfter();
-                }
-                break;
-            default:
-                break;
-        }
-        return node;
-    }
-
-    private Node getOriginal(DataObjectModification<Node> mod) {
-        Node node = null;
-        switch(mod.getModificationType()) {
-            case SUBTREE_MODIFIED:
-                node = mod.getDataBefore();
-                break;
-            case WRITE:
-                if(mod.getDataBefore() !=  null) {
-                    node = mod.getDataBefore();
-                }
-                break;
-            case DELETE:
-                node = mod.getDataBefore();
-                break;
-            default:
-                break;
-        }
-        return node;
-    }
-
-    private Map<InstanceIdentifier<Node>, Node> extractCreatedOrUpdatedOrRemoved(
-            Collection<DataTreeModification<Node>> changes, Class<Node> class1) {
-        // TODO Auto-generated method stub
-        Map<InstanceIdentifier<Node>, Node> result = new HashMap<InstanceIdentifier<Node>, Node>();
-        for (DataTreeModification<Node> change : changes) {
-            final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
-            final DataObjectModification<Node> mod = change.getRootNode();
-            Node created = getCreated(mod);
-            result.put(key, created);
-            Node updated = getUpdated(mod);
-            result.put(key, updated);
-            Node deleted = getRemoved(mod);
-            result.put(key, deleted);
-        }
-        return result;
-    }
-
     public Optional<Node> getGlobalNode(InstanceIdentifier<?> iid) {
         InstanceIdentifier<Node> nodeIid = iid.firstIdentifierOf(Node.class);
         return Optional.fromNullable(operationalNodes.get(nodeIid));
     }
 
-    public Optional<LogicalSwitches> getLogicalSwitches(InstanceIdentifier<?> iid) {
+    public Optional<LogicalSwitches> getLogicalSwitches(InstanceIdentifier<?> iid, LogicalSwitchesKey lswitchKey) {
         Optional<Node> nodeOptional = getGlobalNode(iid);
-        /*if (nodeOptional.isPresent()) {
-            return Optional.fromNullable(nodeOptional.get().getAugmentation(HwvtepLogicalSwitchAugmentation.class));
-        }*/
+        if (nodeOptional.isPresent()) {
+            List<LogicalSwitches> lswitchList = nodeOptional.get().getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+            if (lswitchList != null) {
+                for (LogicalSwitches lswitch: lswitchList) {
+                    if (lswitch.getKey().equals(lswitchKey)) {
+                        return Optional.fromNullable(lswitch);
+                    }
+                }
+            }
+        }
         return Optional.absent();
     }
 
@@ -154,6 +91,7 @@ public class HwvtepOperationalState {
 
     public Optional<LocatorSet> getPhysicalLocatorSet(InstanceIdentifier<?> iid) {
         Optional<Node> nodeOptional = getGlobalNode(iid);
+        //TODO: physical locator set are under different logical switches
         /*if (nodeOptional.isPresent()) {
             return Optional.fromNullable(nodeOptional.get().getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches());
         }*/
index 8a8fbd70f8e55fd08436113e44215a9f7c1c4e4a..e8498c7f7ea876f40b9452b149c21527e44dd10a 100644 (file)
@@ -13,15 +13,14 @@ import static org.opendaylight.ovsdb.lib.operations.Operations.op;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -43,106 +42,111 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand {
 
     @Override
     public void execute(TransactionBuilder transaction) {
-        Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> created =
+        Map<InstanceIdentifier<Node>, List<LogicalSwitches>> createds =
                 extractCreated(getChanges(),LogicalSwitches.class);
-        if (!created.isEmpty()) {
-            for(Entry<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> logicalSwitchEntry:
-                created.entrySet()) {
-                updateLogicalSwitch(transaction,  logicalSwitchEntry.getKey(), logicalSwitchEntry.getValue());
+        if (!createds.isEmpty()) {
+            for (Entry<InstanceIdentifier<Node>, List<LogicalSwitches>> created:
+                createds.entrySet()) {
+                updateLogicalSwitch(transaction,  created.getKey(), created.getValue());
             }
         }
-        Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> updated =
+        Map<InstanceIdentifier<Node>, List<LogicalSwitches>> updateds =
                 extractUpdated(getChanges(),LogicalSwitches.class);
-        if(!updated.isEmpty()) {
-            for(Entry<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> logicalSwitchEntry:
-                updated.entrySet()) {
-                updateLogicalSwitch(transaction,  logicalSwitchEntry.getKey(), logicalSwitchEntry.getValue());
+        if (!updateds.isEmpty()) {
+            for (Entry<InstanceIdentifier<Node>, List<LogicalSwitches>> updated:
+                updateds.entrySet()) {
+                updateLogicalSwitch(transaction,  updated.getKey(), updated.getValue());
             }
         }
     }
 
-
     private void updateLogicalSwitch(TransactionBuilder transaction,
-            InstanceIdentifier<LogicalSwitches> iid, LogicalSwitches logicalSwitches) {
-        LOG.debug("Creating a logical switch named: {}", logicalSwitches.getHwvtepNodeName());
-        Optional<LogicalSwitches> operationalLogicalSwitchOptional =
-                getOperationalState().getLogicalSwitches(iid);
-        DatabaseSchema dbSchema = transaction.getDatabaseSchema();
-        LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalSwitch.class);
-        if(!operationalLogicalSwitchOptional.isPresent()) {
-            setName(logicalSwitch, logicalSwitches, operationalLogicalSwitchOptional);
-            setTunnelKey(logicalSwitch, logicalSwitches, operationalLogicalSwitchOptional);
-            transaction.add(op.insert(logicalSwitch));
-        } else {
-            String existingLogicalSwitchName = operationalLogicalSwitchOptional.get().getHwvtepNodeName().getValue();
-            // Name is immutable, and so we *can't* update it.  So we use extraBridge for the schema stuff
-            LogicalSwitch extraLogicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalSwitch.class);
-            extraLogicalSwitch.setName("");
-            transaction.add(op.update(logicalSwitch)
-                    .where(extraLogicalSwitch.getNameColumn().getSchema().opEqual(existingLogicalSwitchName))
-                    .build());
-            //stampInstanceIdentifier(transaction, iid.firstIdentifierOf(Node.class),existingBridgeName);
+            InstanceIdentifier<Node> instanceIdentifier, List<LogicalSwitches> lswitchList) {
+        for (LogicalSwitches lswitch: lswitchList) {
+            LOG.debug("Creating logcial switch named: {}", lswitch.getHwvtepNodeName());
+            Optional<LogicalSwitches> operationalSwitchOptional =
+                    getOperationalState().getLogicalSwitches(instanceIdentifier, lswitch.getKey());
+            LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalSwitch.class);
+            setDescription(logicalSwitch, lswitch);
+            setTunnelKey(logicalSwitch, lswitch);
+            if (!operationalSwitchOptional.isPresent()) {
+                setName(logicalSwitch, lswitch, operationalSwitchOptional);
+                transaction.add(op.insert(logicalSwitch));
+            } else {
+                LogicalSwitches updatedLSwitch = operationalSwitchOptional.get();
+                String existingLogicalSwitchName = updatedLSwitch.getHwvtepNodeName().getValue();
+                // Name is immutable, and so we *can't* update it.  So we use extraBridge for the schema stuff
+                LogicalSwitch extraLogicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalSwitch.class);
+                extraLogicalSwitch.setName("");
+                transaction.add(op.update(logicalSwitch)
+                        .where(extraLogicalSwitch.getNameColumn().getSchema().opEqual(existingLogicalSwitchName))
+                        .build());
+            }
         }
     }
 
-    private void setName(LogicalSwitch logicalSwitch, LogicalSwitches logicalSwitches,
-            Optional<LogicalSwitches> operationalLogicalSwitchOptional) {
-        if(logicalSwitches.getHwvtepNodeName() != null) {
-            logicalSwitch.setName(logicalSwitches.getHwvtepNodeName().getValue());
-        } else if(operationalLogicalSwitchOptional.isPresent() && operationalLogicalSwitchOptional.get().getHwvtepNodeName() != null) {
-            logicalSwitch.setName(operationalLogicalSwitchOptional.get().getHwvtepNodeName().getValue());
+    private void setDescription(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+        if(inputSwitch.getHwvtepNodeDescription() != null) {
+            logicalSwitch.setDescription(inputSwitch.getHwvtepNodeDescription());
         }
     }
 
-    private void setTunnelKey(LogicalSwitch logicalSwitch, LogicalSwitches logicalSwitches,
-            Optional<LogicalSwitches> operationalLogicalSwitchOptional) {
-        if(logicalSwitches.getTunnelKey() != null) {
-            Set<Long> tunnel = new HashSet<Long>();
-            tunnel.add(Long.valueOf(logicalSwitches.getTunnelKey()));
-            logicalSwitch.setTunnelKey(tunnel);
-        } else if(operationalLogicalSwitchOptional.isPresent() && operationalLogicalSwitchOptional.get().getTunnelKey() != null) {
+    private void setName(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch,
+            Optional<LogicalSwitches> inputSwitchOptional) {
+        if (inputSwitch.getHwvtepNodeName() != null) {
+            logicalSwitch.setName(inputSwitch.getHwvtepNodeName().getValue());
+        } else if (inputSwitchOptional.isPresent() && inputSwitchOptional.get().getHwvtepNodeName() != null) {
+            logicalSwitch.setName(inputSwitchOptional.get().getHwvtepNodeName().getValue());
+        }
+    }
+
+    private void setTunnelKey(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+        if (inputSwitch.getTunnelKey() != null) {
             Set<Long> tunnel = new HashSet<Long>();
-            tunnel.add(Long.valueOf(operationalLogicalSwitchOptional.get().getTunnelKey()));
+            tunnel.add(Long.valueOf(inputSwitch.getTunnelKey()));
             logicalSwitch.setTunnelKey(tunnel);
         }
     }
 
-    private Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> extractCreated(
+    private Map<InstanceIdentifier<Node>, List<LogicalSwitches>> extractCreated(
             Collection<DataTreeModification<Node>> changes, Class<LogicalSwitches> class1) {
-        Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> result
-            = new HashMap<InstanceIdentifier<LogicalSwitches>, LogicalSwitches>();
-        if(changes != null && !changes.isEmpty()) {
-            for(DataTreeModification<Node> change : changes) {
+        Map<InstanceIdentifier<Node>, List<LogicalSwitches>> result
+            = new HashMap<InstanceIdentifier<Node>, List<LogicalSwitches>>();
+        if (changes != null && !changes.isEmpty()) {
+            for (DataTreeModification<Node> change : changes) {
                 final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
                 final DataObjectModification<Node> mod = change.getRootNode();
                 Node created = TransactUtils.getCreated(mod);
-                if(created != null) {
-/*                    LogicalSwitches logicalSwitch = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
-                    InstanceIdentifier<LogicalSwitches> iid = change.getRootPath().getRootIdentifier().augmentation(LogicalSwitches.class);
-                    if(logicalSwitch != null) {
-                        result.put(iid, logicalSwitch);
-                    }*/
+                if (created != null) {
+                    List<LogicalSwitches> lswitchListUpdated = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    if (lswitchListUpdated != null) {
+                        result.put(key, lswitchListUpdated);
+                    }
                 }
             }
         }
         return result;
     }
 
-    private Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> extractUpdated(
+    private Map<InstanceIdentifier<Node>, List<LogicalSwitches>> extractUpdated(
             Collection<DataTreeModification<Node>> changes, Class<LogicalSwitches> class1) {
-        Map<InstanceIdentifier<LogicalSwitches>, LogicalSwitches> result
-            = new HashMap<InstanceIdentifier<LogicalSwitches>, LogicalSwitches>();
-        if(changes != null && !changes.isEmpty()) {
-            for(DataTreeModification<Node> change : changes) {
+        Map<InstanceIdentifier<Node>, List<LogicalSwitches>> result
+            = new HashMap<InstanceIdentifier<Node>, List<LogicalSwitches>>();
+        if (changes != null && !changes.isEmpty()) {
+            for (DataTreeModification<Node> change : changes) {
                 final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
                 final DataObjectModification<Node> mod = change.getRootNode();
                 Node updated = TransactUtils.getUpdated(mod);
-                if(updated != null) {
-/*                    LogicalSwitches logicalSwitch = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
-                    InstanceIdentifier<LogicalSwitches> iid = change.getRootPath().getRootIdentifier().augmentation(LogicalSwitches.class);
-                    if(logicalSwitch != null) {
-                        result.put(iid, logicalSwitch);
-                    }*/
+                Node before = mod.getDataBefore();
+                if (updated != null && before != null) {
+                    List<LogicalSwitches> lswitchListUpdated = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    List<LogicalSwitches> lswitchListBefore = before.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    if (lswitchListUpdated != null) {
+                        if (lswitchListBefore != null) {
+                            lswitchListUpdated.removeAll(lswitchListBefore);
+                        }
+                        result.put(key, lswitchListUpdated);
+                    }
                 }
             }
         }
index 488cb9269da6a3155cb679f44ae627a33797889f..a62175069274cc6478431d8b692e65753d61a3e4 100644 (file)
@@ -74,21 +74,27 @@ public class TransactUtils {
         return node;
     }
 
+    //TODO: change this function to be generic
     public static Map<InstanceIdentifier<Node>, Node> extractCreatedOrUpdatedOrRemoved(
             Collection<DataTreeModification<Node>> changes, Class<Node> class1) {
-        // TODO Auto-generated method stub
         Map<InstanceIdentifier<Node>, Node> result = new HashMap<InstanceIdentifier<Node>, Node>();
         for(DataTreeModification<Node> change : changes) {
             final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
             final DataObjectModification<Node> mod = change.getRootNode();
             Node created = getCreated(mod);
-            result.put(key, created);
+            if (created != null) {
+                result.put(key, created);
+            }
             Node updated = getUpdated(mod);
-            result.put(key, updated);
+            if (updated != null) {
+                result.put(key, updated);
+            }
             Node deleted = getRemoved(mod);
-            result.put(key, deleted);
+            if (deleted != null) {
+                result.put(key, deleted);
+            }
         }
-        return null;
+        return result;
     }
 
     /*
index 045377e0437531a82f0c068abe2f91cde82e2375..a6364a815ae3048fdd35f1818f4714f7319734fc 100644 (file)
@@ -13,7 +13,6 @@ import java.util.Map.Entry;
 
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
@@ -22,14 +21,9 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
-import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalPort;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeVxlanOverIpv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
 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.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
@@ -82,7 +76,7 @@ public class PhysicalLocatorUpdateCommand extends AbstractTransactionCommand {
                         new HwvtepPhysicalLocatorAugmentationBuilder();
                 setEncapsType(tpAugmentationBuilder, pLoc);
                 setDstIp(tpAugmentationBuilder, pLoc);
-                tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
+                tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
                 if (oldPLocRows.containsKey(pLocUpdate.getKey())) {
                     transaction.merge(LogicalDatastoreType.OPERATIONAL,
                             tpPath, tpBuilder.build());
index 45fd82f5f1f9e5c1c2fed7421fefadd7fc4cdf44..524fa8b1dc080c27b5d334e23630b2a1a8800695 100755 (executable)
@@ -29,7 +29,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,