}
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;
}
}
- 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 {
}
}
}
- list interfaces {
- description "List of interfaces associated with this router object.";
- key "uuid";
- uses interface-attributes;
- }
}
}
}
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;
}
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;
}
@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() {
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;
", distributed=" + distributed +
", gw_port_id=" + gatewayPortId +
", routes=" + routes +
- ", interfaces=" + interfaces +
"]";
}
}
}
- target.addInterface(input.getPortUUID(), input);
if (instances != null) {
for (Object instance : instances) {
INeutronRouterAware service = (INeutronRouterAware) instance;
return Response.status(HttpURLConnection.HTTP_OK).entity(input).build();
}
-
private int checkDownstreamDetach(NeutronRouter target, NeutronRouter_Interface input) {
Object[] instances = getInstances();
if (instances != null) {
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;
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;
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;
@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
}
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 {
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;
}
}