315a7d4ce9850b17bf5c79113abf2067b086172b
[groupbasedpolicy.git] / renderers / iovisor / src / main / java / org / opendaylight / groupbasedpolicy / renderer / iovisor / utils / IovisorIidFactory.java
1 /*
2  * Copyright (c) 2015 Inocybe Technologies and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.groupbasedpolicy.renderer.iovisor.utils;
10
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.EndpointGroupId;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.L3ContextId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.IovisorModuleInstances;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.IovisorModulesByTenantByEndpointgroupId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.IovisorResolvedEndpoints;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.IovisorResolvedEndpointsByTenantByEndpointgroupId;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.module.instances.IovisorModuleInstance;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.module.instances.IovisorModuleInstanceKey;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.modules.by.tenant.by.endpointgroup.id.IovisorModuleByTenantByEndpointgroupId;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.modules.by.tenant.by.endpointgroup.id.IovisorModuleByTenantByEndpointgroupIdKey;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.resolved.endpoints.IovisorResolvedEndpoint;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.resolved.endpoints.IovisorResolvedEndpointKey;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.resolved.endpoints.by.tenant.by.endpointgroup.id.IovisorResolvedEndpointByTenantByEndpointgroupId;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.iovisor.rev151030.iovisor.resolved.endpoints.by.tenant.by.endpointgroup.id.IovisorResolvedEndpointByTenantByEndpointgroupIdKey;
27 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
28
29 public class IovisorIidFactory {
30
31     private IovisorIidFactory() {}
32
33     private static final InstanceIdentifier<IovisorModuleInstances> IOVISOR_MODULE_INSTANCES_IID =
34             InstanceIdentifier.builder(IovisorModuleInstances.class).build();
35
36     /**
37      * @return The {@link InstanceIdentifier} of the {@link IovisorModuleInstances}
38      */
39     public static InstanceIdentifier<IovisorModuleInstances> iovisorModuleInstanceWildCardIid() {
40         return IOVISOR_MODULE_INSTANCES_IID;
41     }
42
43     /**
44      * Return the InstanceIdentifier for a specific IovisorModuleInstance.
45      *
46      * @param iovisorModuleInstanceKey The key of the {@link IovisorModuleInstance} we want to
47      *        retrieve.
48      * @return The {@link InstanceIdentifier} of the {@link IovisorModuleInstance}
49      */
50     public static InstanceIdentifier<IovisorModuleInstance> iovisorModuleInstanceIid(
51             IovisorModuleInstanceKey iovisorModuleInstanceKey) {
52         return IOVISOR_MODULE_INSTANCES_IID.child(IovisorModuleInstance.class, iovisorModuleInstanceKey);
53     }
54
55     public static InstanceIdentifier<IovisorResolvedEndpoints> iovisorResolvedEndpointWildcardIid() {
56         return InstanceIdentifier.builder(IovisorResolvedEndpoints.class).build();
57     }
58
59     public static InstanceIdentifier<IovisorResolvedEndpoint> iovisorResolvedEndpointIid(L3ContextId l3Context,
60             IpAddress ipAddress) {
61         return iovisorResolvedEndpointIid(new IovisorResolvedEndpointKey(ipAddress, l3Context));
62     }
63
64     public static InstanceIdentifier<IovisorResolvedEndpoint> iovisorResolvedEndpointIid(
65             IovisorResolvedEndpointKey iovisorResolvedEndpointKey) {
66         return InstanceIdentifier.builder(IovisorResolvedEndpoints.class)
67             .child(IovisorResolvedEndpoint.class, iovisorResolvedEndpointKey)
68             .build();
69     }
70
71     public static InstanceIdentifier<IovisorResolvedEndpointsByTenantByEndpointgroupId> iovisorResolvedEndpointsByTenantIdByEndpointGroupIdWildCardIid() {
72         return InstanceIdentifier.builder(IovisorResolvedEndpointsByTenantByEndpointgroupId.class).build();
73     }
74
75     public static InstanceIdentifier<IovisorResolvedEndpointByTenantByEndpointgroupId> iovisorResolvedEndpointByTenantIdByEndpointGroupIdIid(
76             TenantId tenantId, EndpointGroupId epgId) {
77         return iovisorResolvedEndpointByTenantIdByEndpointGroupIdIid(
78                 new IovisorResolvedEndpointByTenantByEndpointgroupIdKey(epgId, tenantId));
79     }
80
81     public static InstanceIdentifier<IovisorResolvedEndpointByTenantByEndpointgroupId> iovisorResolvedEndpointByTenantIdByEndpointGroupIdIid(
82             IovisorResolvedEndpointByTenantByEndpointgroupIdKey key) {
83         return InstanceIdentifier.builder(IovisorResolvedEndpointsByTenantByEndpointgroupId.class)
84             .child(IovisorResolvedEndpointByTenantByEndpointgroupId.class, key)
85             .build();
86     }
87
88     public static InstanceIdentifier<IovisorModulesByTenantByEndpointgroupId> iovisorModulesByTenantIdByEndpointGroupIdWildCardIid() {
89         return InstanceIdentifier.builder(IovisorModulesByTenantByEndpointgroupId.class).build();
90     }
91
92     public static InstanceIdentifier<IovisorModuleByTenantByEndpointgroupId> iovisorModuleByTenantIdByEndpointGroupIdIid(
93             TenantId tenantId, EndpointGroupId epgId) {
94         return iovisorModuleByTenantIdByEndpointGroupIdIid(
95                 new IovisorModuleByTenantByEndpointgroupIdKey(epgId, tenantId));
96     }
97
98     public static InstanceIdentifier<IovisorModuleByTenantByEndpointgroupId> iovisorModuleByTenantIdByEndpointGroupIdIid(
99             IovisorModuleByTenantByEndpointgroupIdKey key) {
100         return InstanceIdentifier.builder(IovisorModulesByTenantByEndpointgroupId.class)
101             .child(IovisorModuleByTenantByEndpointgroupId.class, key)
102             .build();
103     }
104
105 }