yang model revise: neutron-L3.yang 35/35835/8
authorIsaku Yamahata <isaku.yamahata@intel.com>
Fri, 4 Mar 2016 01:02:57 +0000 (17:02 -0800)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Fri, 10 Jun 2016 09:14:03 +0000 (02:14 -0700)
This patch revises yang model for neutron-L3 and related codes.
- remove backpointer as interface-attributes
- pyang warning. missing key in leaf list
- remove deprecated methods in neutron spi
  If openstack provider needs to find a list of interfaces attached
  to a given neutron router, it walk through a list of ports to
  find a port whose device owner is router and device id is uuid
  of the router.

Change-Id: I245a880437369448933e9a41feb078a8baecc4d9
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
model/src/main/yang/neutron-L3.yang
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronFloatingIP.java
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronRouter.java
northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronRouterInterface.java

index 4442c414d446db178b719cf3c40e2ab8569a2516..997412bae898a0e144eee3d8df718ca36c2b9911 100644 (file)
@@ -41,6 +41,7 @@ module neutron-L3 {
         }
         list routes {
             description "list of routes for this router.";
+            key "destination nexthop";
             leaf destination {
                 description "Specifies a destination in CIDR format";
                 type inet:ip-prefix;
@@ -97,25 +98,6 @@ module neutron-L3 {
         }
     }
 
-    grouping interface-attributes {
-        leaf uuid {
-            type yang:uuid;
-            description "UUID to index this object.";
-        }
-        leaf tenant-id {
-            type yang:uuid;
-            description "The Tenant ID of this object.";
-        }
-        leaf subnet-id {
-            description "Contains the Subnet ID of the interface.";
-            type yang:uuid;
-        }
-        leaf port-id {
-            description "Contains the Port ID of the interface.";
-            type yang:uuid;
-        }
-    }
-
     grouping routers-attributes {
         container routers {
             list router {
@@ -150,11 +132,6 @@ module neutron-L3 {
                         }
                     }
                 }
-                list interfaces {
-                    description "List of interfaces associated with this router object.";
-                    key "uuid";
-                    uses interface-attributes;
-                }
             }
         }
     }
index cf03a40e672cc349c109ae4d95ca5d214099755c..564ed35ed711d0839f3e0ca82dd8a833b9b7881c 100644 (file)
@@ -47,16 +47,6 @@ public class NeutronFloatingIP extends NeutronObject implements Serializable, IN
     public NeutronFloatingIP() {
     }
 
-    // @deprecated use getID()
-    public String getFloatingIPUUID() {
-        return getID();
-    }
-
-    // @deprecated use setID()
-    public void setFloatingIPUUID(String uuid) {
-        setID(uuid);
-    }
-
     public String getFloatingNetworkUUID() {
         return floatingNetworkUUID;
     }
@@ -93,16 +83,6 @@ public class NeutronFloatingIP extends NeutronObject implements Serializable, IN
         this.floatingIPAddress = floatingIPAddress;
     }
 
-    @Deprecated
-    public String getTenantUUID() {
-        return getTenantID();
-    }
-
-    @Deprecated
-    public void setTenantUUID(String tenantID) {
-        setTenantID(tenantID);
-    }
-
     public void setRouterUUID(String routerUUID) {
         this.routerUUID = routerUUID;
     }
index 6c296204a2f6e5233dc4dad63da2455cdd963033..486057e044229629c2c716c2a2fefb7ee0ff59ec 100644 (file)
@@ -48,23 +48,7 @@ public class NeutronRouter extends NeutronObject implements Serializable, INeutr
     @XmlElement (name = "routes")
     List<NeutronRoute> routes;
 
-    /* Holds a map of OpenStackRouterInterfaces by subnet UUID
-     * used for internal mapping to DOVE
-     */
-    Map<String, NeutronRouter_Interface> interfaces;
-
     public NeutronRouter() {
-        interfaces = new HashMap<String, NeutronRouter_Interface>();
-    }
-
-    @Deprecated
-    public String getRouterUUID() {
-        return getID();
-    }
-
-    @Deprecated
-    public void setRouterUUID(String uuid) {
-        setID(uuid);
     }
 
     public String getName() {
@@ -173,22 +157,6 @@ public class NeutronRouter extends NeutronObject implements Serializable, INeutr
         return ans;
     }
 
-    public void setInterfaces(Map<String, NeutronRouter_Interface> input) {
-        interfaces = input;
-    }
-
-    public Map<String, NeutronRouter_Interface> getInterfaces() {
-        return interfaces;
-    }
-
-    public void addInterface(String s, NeutronRouter_Interface i) {
-        interfaces.put(s, i);
-    }
-
-    public void removeInterface(String s) {
-        interfaces.remove(s);
-    }
-
     @Override
     public void initDefaults() {
         adminStateUp = true;
@@ -206,7 +174,6 @@ public class NeutronRouter extends NeutronObject implements Serializable, INeutr
             ", distributed=" + distributed +
             ", gw_port_id=" + gatewayPortId +
             ", routes=" + routes +
-            ", interfaces=" + interfaces +
             "]";
     }
 
index 708d7d5f757c24408dc6feab8ba0a85b5a083aac..4b266fc71d5b5968803dd9d99f271af0da739a56 100644 (file)
@@ -313,7 +313,6 @@ public class NeutronRoutersNorthbound
             }
         }
 
-        target.addInterface(input.getPortUUID(), input);
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
@@ -324,7 +323,6 @@ public class NeutronRoutersNorthbound
         return Response.status(HttpURLConnection.HTTP_OK).entity(input).build();
     }
 
-
     private int checkDownstreamDetach(NeutronRouter target, NeutronRouter_Interface input) {
         Object[] instances = getInstances();
         if (instances != null) {
@@ -365,7 +363,6 @@ public class NeutronRoutersNorthbound
         if (status != HTTP_OK_BOTTOM) {
             return Response.status(status).build();
         }
-        target.removeInterface(input.getPortUUID());
         if (instances != null) {
             for (Object instance : instances) {
                 INeutronRouterAware service = (INeutronRouterAware) instance;
index 1cc4856678c80a3aaa915b692b9949caad2a76fc..ef80fdffd25b7a5baf216ddcd196b76412a0f72e 100644 (file)
@@ -9,17 +9,12 @@
 package org.opendaylight.neutron.transcriber;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.neutron.spi.INeutronRouterCRUD;
 import org.opendaylight.neutron.spi.NeutronRoute;
 import org.opendaylight.neutron.spi.Neutron_IPs;
 import org.opendaylight.neutron.spi.NeutronRouter;
-import org.opendaylight.neutron.spi.NeutronRouter_Interface;
 import org.opendaylight.neutron.spi.NeutronRouter_NetworkReference;
 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.IpPrefix;
@@ -31,7 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.router
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.ExternalGatewayInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.ExternalGatewayInfoBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIpsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.Interfaces;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router.external_gateway_info.ExternalFixedIps;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -89,11 +83,7 @@ public class NeutronRouterInterface extends AbstractNeutronInterface<Router, Rou
 
     @Override
     public boolean routerInUse(String routerUUID) {
-        if (!exists(routerUUID)) {
-            return true;
-        }
-        final NeutronRouter target = getRouter(routerUUID);
-        return (target.getInterfaces().size() > 0);
+        return !exists(routerUUID);
     }
 
     @Override
@@ -150,14 +140,6 @@ public class NeutronRouterInterface extends AbstractNeutronInterface<Router, Rou
             }
             routerBuilder.setExternalGatewayInfo(externalGatewayInfo);
         }
-        if (router.getInterfaces() != null) {
-            final Map<String, NeutronRouter_Interface> mapInterfaces = new HashMap<String, NeutronRouter_Interface>();
-            final List<Interfaces> interfaces = new ArrayList<Interfaces>();
-            for (final Entry<String, NeutronRouter_Interface> entry : mapInterfaces.entrySet()) {
-                interfaces.add((Interfaces) entry.getValue());
-            }
-            routerBuilder.setInterfaces(interfaces);
-        }
         if (router.getID() != null) {
             routerBuilder.setUuid(toUuid(router.getID()));
         } else {
@@ -234,19 +216,6 @@ public class NeutronRouterInterface extends AbstractNeutronInterface<Router, Rou
             result.setExternalGatewayInfo(extGwInfo);
         }
 
-        if (router.getInterfaces() != null) {
-            final Map<String, NeutronRouter_Interface> interfaces = new HashMap<String, NeutronRouter_Interface>();
-            for (final Interfaces mdInterface : router.getInterfaces()) {
-                final NeutronRouter_Interface pojoInterface = new NeutronRouter_Interface();
-                final String id = mdInterface.getUuid().getValue();
-                pojoInterface.setID(id);
-                pojoInterface.setTenantID(mdInterface.getTenantId());
-                pojoInterface.setSubnetUUID(String.valueOf(mdInterface.getSubnetId().getValue()));
-                pojoInterface.setPortUUID(String.valueOf(mdInterface.getPortId().getValue()));
-                interfaces.put(id, pojoInterface);
-            }
-            result.setInterfaces(interfaces);
-        }
         return result;
     }
 }