NeutronRouter ans = new NeutronRouter(); for (String s : fields) { switch (s) { case "id": ans.setRouterUUID(this.getRouterUUID()); break; case "name": ans.setName(this.getName()); break; case "admin_state_up": ans.setAdminStateUp(this.getAdminStateUp()); break; case "status": ans.setStatus(this.getStatus()); break; case "tenant_id": ans.setTenantID(this.getTenantID()); break; case "external_gateway_info": ans.setExternalGatewayInfo(this.getExternalGatewayInfo()); break; case "distributed": ans.setDistributed(this.getDistributed()); break; case "gw_port_id": ans.setGatewayPortId(this.getGatewayPortId()); break; case "routes": ans.setRoutes(this.getRoutes());
@Override public boolean addRouter(NeutronRouter input) { if (routerExists(input.getID())) { return false; } addMd(input); return true; }
public NeutronRouter fromMd(Router router) { NeutronRouter result = new NeutronRouter(); result.setID(String.valueOf(router.getUuid().getValue())); result.setName(router.getName()); result.setTenantID(String.valueOf(router.getTenantId().getValue())); result.setAdminStateUp(router.isAdminStateUp()); result.setStatus(router.getStatus()); result.setDistributed(router.isDistributed()); if (router.getGatewayPortId() != null) { result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue())); routes.add(route); result.setRoutes(routes); result.setExternalGatewayInfo(extGwInfo);
if (router.getRouterUUID() != null) { routerBuilder.setUuid(toUuid(router.getRouterUUID())); if (router.getName() != null) { routerBuilder.setName(router.getName()); if (router.getTenantID() != null && !router.getTenantID().isEmpty()) { routerBuilder.setTenantId(toUuid(router.getTenantID())); if (router.getStatus() != null) { routerBuilder.setStatus(router.getStatus()); if (router.getGatewayPortId() != null && !router.getGatewayPortId().isEmpty()) { routerBuilder.setGatewayPortId(toUuid(router.getGatewayPortId())); routerBuilder.setAdminStateUp(router.getAdminStateUp()); routerBuilder.setDistributed(router.getDistributed()); if (router.getRoutes() != null) { List<Routes> routes = new ArrayList<>(); for (Routes route : router.getRoutes()) { routes.add(route); if (router.getExternalGatewayInfo() != null) { ExternalGatewayInfo externalGatewayInfo = null; List<NeutronRouter_NetworkReference> neutronRouter_NetworkReferences = new ArrayList<>(); neutronRouter_NetworkReferences.add(router.getExternalGatewayInfo()); for (NeutronRouter_NetworkReference externalGatewayInfos : neutronRouter_NetworkReferences) { ExternalGatewayInfoBuilder builder = new ExternalGatewayInfoBuilder();
/** * Services provide this interface method to indicate if the specified interface can be attached to the specified * route * * @param router * instance of the base Neutron Router object * @param routerInterface * instance of the NeutronRouter_Interface to be attached to the router * @return integer * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 * results in the attach operation being interrupted and the returned status value reflected in the * HTTP response. */ @Override public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface) { LOG.debug(" Router {} asked if it can attach interface {}. Subnet {}", router.getName(), routerInterface.getPortUUID(), routerInterface.getSubnetUUID()); return HttpURLConnection.HTTP_OK; }
private NeutronRouter fromMd(Router router) { NeutronRouter result = new NeutronRouter(); result.setID(String.valueOf(router.getUuid().getValue())); result.setName(router.getName()); if (router.getTenantId() != null) { result.setTenantID(String.valueOf(router.getTenantId().getValue())); result.setAdminStateUp(router.isAdminStateUp()); result.setStatus(router.getStatus()); result.setDistributed(router.isDistributed()); if (router.getGatewayPortId() != null) { result.setGatewayPortId(String.valueOf(router.getGatewayPortId().getValue())); routes.add(route); result.setRoutes(routes); result.setExternalGatewayInfo(extGwInfo);
/** * Services provide this interface method to indicate if the specified interface can be detached from the specified * router * * @param router * instance of the base Neutron Router object * @param routerInterface * instance of the NeutronRouter_Interface to be detached to the router * @return integer * the return value is understood to be a HTTP status code. A return value outside of 200 through 299 * results in the detach operation being interrupted and the returned status value reflected in the * HTTP response. */ @Override public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface) { LOG.debug(" Router {} asked if it can detach interface {}. Subnet {}", router.getName(), routerInterface.getPortUUID(), routerInterface.getSubnetUUID()); return HttpURLConnection.HTTP_OK; }