Using nonNull API's in ELAN
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / utils / StaleVlanBindingsCleaner.java
index b44ec27322a5c38d875c28af305386b54df24e66..48c7c2ef54d9f94356bbd37d83adf7d9909dfd27 100644 (file)
@@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 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.NodeBuilder;
 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.TerminationPointKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -158,15 +159,15 @@ public class StaleVlanBindingsCleaner {
 
     private static Map<String, List<InstanceIdentifier<VlanBindings>>> getVlansByLogicalSwitchOnDevice(
             final Node configPsNode) {
-        List<TerminationPoint> ports = configPsNode.getTerminationPoint();
+        Map<TerminationPointKey, TerminationPoint> ports = configPsNode.nonnullTerminationPoint();
         if (ports == null) {
             return Collections.emptyMap();
         }
         Map<String, List<InstanceIdentifier<VlanBindings>>> vlans = new HashMap<>();
-        ports.stream()
+        ports.values().stream()
                 .filter(CONTAINS_VLANBINDINGS)
                 .forEach((port) -> port.augmentation(HwvtepPhysicalPortAugmentation.class)
-                        .getVlanBindings()
+                        .nonnullVlanBindings().values()
                         .forEach((binding) -> putVlanBindingVsLogicalSwitch(configPsNode, vlans, port, binding)));
         return vlans;
     }
@@ -210,7 +211,7 @@ public class StaleVlanBindingsCleaner {
             return Collections.emptyList();
         }
         return augmentation
-                .getLogicalSwitches()
+                .nonnullLogicalSwitches().values()
                 .stream()
                 .map((ls) -> ls.getHwvtepNodeName().getValue())
                 .collect(Collectors.toList());