Merge "GBP UI fixes"
[groupbasedpolicy.git] / neutron-mapper / src / main / java / org / opendaylight / groupbasedpolicy / neutron / mapper / mapping / MappingFactory.java
1 package org.opendaylight.groupbasedpolicy.neutron.mapper.mapping;
2
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.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.floating.ip.ports.EndpointByFloatingIpPort;
6 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.floating.ip.ports.EndpointByFloatingIpPortBuilder;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.ports.EndpointByPort;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.ports.EndpointByPortBuilder;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router._interface.ports.EndpointByRouterInterfacePort;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router._interface.ports.EndpointByRouterInterfacePortBuilder;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router.gateway.ports.EndpointByRouterGatewayPort;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.gbp.by.neutron.mappings.endpoints.by.router.gateway.ports.EndpointByRouterGatewayPortBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.floating.ip.ports.by.endpoints.FloatingIpPortByEndpoint;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.floating.ip.ports.by.endpoints.FloatingIpPortByEndpointBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.ports.by.endpoints.PortByEndpoint;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.ports.by.endpoints.PortByEndpointBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router._interface.ports.by.endpoints.RouterInterfacePortByEndpoint;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router._interface.ports.by.endpoints.RouterInterfacePortByEndpointBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router.gateway.ports.by.endpoints.RouterGatewayPortByEndpoint;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.neutron.gbp.mapper.rev150513.mappings.neutron.by.gbp.mappings.router.gateway.ports.by.endpoints.RouterGatewayPortByEndpointBuilder;
21
22 public class MappingFactory {
23
24     private MappingFactory() {
25         throw new UnsupportedOperationException("cannot create an instance");
26     }
27
28     public static EndpointByPort createEndpointByPort(EndpointKey epKey, UniqueId portId) {
29         return new EndpointByPortBuilder().setPortId(portId)
30             .setL2Context(epKey.getL2Context())
31             .setMacAddress(epKey.getMacAddress())
32             .build();
33     }
34
35     public static PortByEndpoint createPortByEndpoint(UniqueId portId, EndpointKey epKey) {
36         return new PortByEndpointBuilder().setPortId(portId)
37             .setL2Context(epKey.getL2Context())
38             .setMacAddress(epKey.getMacAddress())
39             .build();
40     }
41
42     public static EndpointByRouterGatewayPort createEndpointByRouterGatewayPort(EndpointKey epKey, UniqueId portId) {
43         return new EndpointByRouterGatewayPortBuilder().setPortId(portId)
44             .setL2Context(epKey.getL2Context())
45             .setMacAddress(epKey.getMacAddress())
46             .build();
47     }
48
49     public static RouterGatewayPortByEndpoint createRouterGatewayPortByEndpoint(UniqueId portId, EndpointKey epKey) {
50         return new RouterGatewayPortByEndpointBuilder().setPortId(portId)
51             .setL2Context(epKey.getL2Context())
52             .setMacAddress(epKey.getMacAddress())
53             .build();
54     }
55
56     public static EndpointByRouterInterfacePort createEndpointByRouterInterfacePort(EndpointKey epKey, UniqueId portId) {
57         return new EndpointByRouterInterfacePortBuilder().setPortId(portId)
58             .setL2Context(epKey.getL2Context())
59             .setMacAddress(epKey.getMacAddress())
60             .build();
61     }
62
63     public static RouterInterfacePortByEndpoint createRouterInterfacePortByEndpoint(UniqueId portId, EndpointKey epKey) {
64         return new RouterInterfacePortByEndpointBuilder().setPortId(portId)
65             .setL2Context(epKey.getL2Context())
66             .setMacAddress(epKey.getMacAddress())
67             .build();
68     }
69
70     public static EndpointByFloatingIpPort createEndpointByFloatingIpPort(EndpointKey epKey, UniqueId portId) {
71         return new EndpointByFloatingIpPortBuilder().setPortId(portId)
72             .setL2Context(epKey.getL2Context())
73             .setMacAddress(epKey.getMacAddress())
74             .build();
75     }
76
77     public static FloatingIpPortByEndpoint createFloatingIpPortByEndpoint(UniqueId portId, EndpointKey epKey) {
78         return new FloatingIpPortByEndpointBuilder().setPortId(portId)
79             .setL2Context(epKey.getL2Context())
80             .setMacAddress(epKey.getMacAddress())
81             .build();
82     }
83
84 }