1 package org.opendaylight.groupbasedpolicy.neutron.mapper.mapping;
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.UniqueId;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointKey;
5 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Key;
6 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.floating.ip.ports.EndpointByFloatingIpPort;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.floating.ip.ports.EndpointByFloatingIpPortBuilder;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.ports.EndpointByPort;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.ports.EndpointByPortBuilder;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router._interface.ports.EndpointByRouterInterfacePort;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router._interface.ports.EndpointByRouterInterfacePortBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router.gateway.ports.EndpointByRouterGatewayPort;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router.gateway.ports.EndpointByRouterGatewayPortBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.external.gateways.as.l3.endpoints.ExternalGatewayAsL3Endpoint;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.external.gateways.as.l3.endpoints.ExternalGatewayAsL3EndpointBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.external.gateways.as.l3.endpoints.ExternalGatewayAsL3EndpointKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.floating.ip.ports.by.endpoints.FloatingIpPortByEndpoint;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.floating.ip.ports.by.endpoints.FloatingIpPortByEndpointBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.ports.by.endpoints.PortByEndpoint;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.ports.by.endpoints.PortByEndpointBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router._interface.ports.by.endpoints.RouterInterfacePortByEndpoint;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router._interface.ports.by.endpoints.RouterInterfacePortByEndpointBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router.gateway.ports.by.endpoints.RouterGatewayPortByEndpoint;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router.gateway.ports.by.endpoints.RouterGatewayPortByEndpointBuilder;
26 public class MappingFactory {
28 private MappingFactory() {
29 throw new UnsupportedOperationException("cannot create an instance");
32 public static EndpointByPort createEndpointByPort(EndpointKey epKey, UniqueId portId) {
33 return new EndpointByPortBuilder().setPortId(portId)
34 .setL2Context(epKey.getL2Context())
35 .setMacAddress(epKey.getMacAddress())
39 public static PortByEndpoint createPortByEndpoint(UniqueId portId, EndpointKey epKey) {
40 return new PortByEndpointBuilder().setPortId(portId)
41 .setL2Context(epKey.getL2Context())
42 .setMacAddress(epKey.getMacAddress())
46 public static EndpointByRouterGatewayPort createEndpointByRouterGatewayPort(EndpointKey epKey, UniqueId portId) {
47 return new EndpointByRouterGatewayPortBuilder().setPortId(portId)
48 .setL2Context(epKey.getL2Context())
49 .setMacAddress(epKey.getMacAddress())
53 public static RouterGatewayPortByEndpoint createRouterGatewayPortByEndpoint(UniqueId portId, EndpointKey epKey) {
54 return new RouterGatewayPortByEndpointBuilder().setPortId(portId)
55 .setL2Context(epKey.getL2Context())
56 .setMacAddress(epKey.getMacAddress())
60 public static EndpointByRouterInterfacePort createEndpointByRouterInterfacePort(EndpointKey epKey, UniqueId portId) {
61 return new EndpointByRouterInterfacePortBuilder().setPortId(portId)
62 .setL2Context(epKey.getL2Context())
63 .setMacAddress(epKey.getMacAddress())
67 public static RouterInterfacePortByEndpoint createRouterInterfacePortByEndpoint(UniqueId portId, EndpointKey epKey) {
68 return new RouterInterfacePortByEndpointBuilder().setPortId(portId)
69 .setL2Context(epKey.getL2Context())
70 .setMacAddress(epKey.getMacAddress())
74 public static EndpointByFloatingIpPort createEndpointByFloatingIpPort(EndpointKey epKey, UniqueId portId) {
75 return new EndpointByFloatingIpPortBuilder().setPortId(portId)
76 .setL2Context(epKey.getL2Context())
77 .setMacAddress(epKey.getMacAddress())
81 public static FloatingIpPortByEndpoint createFloatingIpPortByEndpoint(UniqueId portId, EndpointKey epKey) {
82 return new FloatingIpPortByEndpointBuilder().setPortId(portId)
83 .setL2Context(epKey.getL2Context())
84 .setMacAddress(epKey.getMacAddress())
88 public static ExternalGatewayAsL3Endpoint createExternalGatewayByL3Endpoint(EndpointL3Key epL3Key) {
89 return new ExternalGatewayAsL3EndpointBuilder().setKey(
90 new ExternalGatewayAsL3EndpointKey(epL3Key.getIpAddress(), epL3Key.getL3Context()))
91 .setIpAddress(epL3Key.getIpAddress())
92 .setL3Context(epL3Key.getL3Context())