introduced LocationResolver
[groupbasedpolicy.git] / groupbasedpolicy / src / main / java / org / opendaylight / groupbasedpolicy / util / IidFactory.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.util;
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.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.EndpointLocations;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoint.locations.AddressEndpointLocation;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoint.locations.AddressEndpointLocationKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoint.locations.ContainmentEndpointLocation;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoint.locations.ContainmentEndpointLocationKey;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.AddressEndpoints;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.ContainmentEndpoints;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpoint;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpointKey;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.containment.endpoints.ContainmentEndpoint;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.containment.endpoints.ContainmentEndpointKey;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.parent.child.endpoints.parent.endpoint.choice.parent.containment.endpoint._case.ParentContainmentEndpoint;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.parent.child.endpoints.parent.endpoint.choice.parent.containment.endpoint._case.ParentContainmentEndpointKey;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.AbsoluteLocation;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.relative.location.RelativeLocations;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.relative.location.relative.locations.ExternalLocation;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.relative.location.relative.locations.ExternalLocationKey;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.relative.location.relative.locations.InternalLocation;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.relative.location.relative.locations.InternalLocationKey;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ActionDefinitionId;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ActionName;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierDefinitionId;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClassifierName;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ClauseName;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ContextId;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ContractId;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.EndpointGroupId;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.L2BridgeDomainId;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.L2FloodDomainId;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.L3ContextId;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.RuleName;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.SelectorName;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.SubjectName;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.SubnetId;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.TenantId;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.Endpoints;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.Endpoint;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointKey;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Key;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Prefix;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3PrefixKey;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.LocationProviders;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.ProviderName;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.location.providers.LocationProvider;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.location.providers.LocationProviderKey;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.location.providers.location.provider.ProviderAddressEndpointLocation;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint_location_provider.rev160419.location.providers.location.provider.ProviderAddressEndpointLocationKey;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.rev160427.AddressType;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.rev160427.ContextType;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.SubjectFeatureDefinitions;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.Tenants;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.has.classifier.refs.ClassifierRef;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.has.classifier.refs.ClassifierRefKey;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ActionDefinition;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ActionDefinitionKey;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinition;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.subject.feature.definitions.ClassifierDefinitionKey;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.Tenant;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.TenantKey;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.ForwardingContext;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.Policy;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2BridgeDomain;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2BridgeDomainKey;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2FloodDomain;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L2FloodDomainKey;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L3Context;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.L3ContextKey;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.Subnet;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.forwarding.context.SubnetKey;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.Contract;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.ContractKey;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroup;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.EndpointGroupKey;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.ExternalImplicitGroup;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.ExternalImplicitGroupKey;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.SubjectFeatureInstances;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.Clause;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.ClauseKey;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.Subject;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.SubjectKey;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.subject.Rule;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.contract.subject.RuleKey;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ConsumerNamedSelector;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ConsumerNamedSelectorKey;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ProviderNamedSelector;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.endpoint.group.ProviderNamedSelectorKey;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ActionInstance;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ActionInstanceKey;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ClassifierInstance;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.policy.subject.feature.instances.ClassifierInstanceKey;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.RendererName;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.Renderers;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.Renderer;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.RendererKey;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.Capabilities;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.Interests;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.capabilities.SupportedActionDefinition;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.capabilities.SupportedClassifierDefinition;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.interests.FollowedTenants;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.interests.followed.tenants.FollowedTenant;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.interests.followed.tenants.FollowedTenantKey;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.interests.followed.tenants.followed.tenant.FollowedEndpointGroup;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.renderer.rev151103.renderers.renderer.interests.followed.tenants.followed.tenant.FollowedEndpointGroupKey;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.statistics.store.rev151215.StatisticsStore;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.statistics.store.rev151215.statistics.store.StatisticRecord;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.statistics.store.rev151215.statistics.store.StatisticRecordKey;
121 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
122
123 public class IidFactory {
124
125     private IidFactory() {
126         throw new UnsupportedOperationException();
127     }
128
129     private static final InstanceIdentifier<Endpoints> ENDPOINTS_IID =
130             InstanceIdentifier.builder(Endpoints.class).build();
131
132     public static InstanceIdentifier<Tenant> tenantIid(TenantId id) {
133         return InstanceIdentifier.builder(Tenants.class).child(Tenant.class, new TenantKey(id)).build();
134     }
135
136     public static InstanceIdentifier<EndpointGroup> endpointGroupIid(TenantId tenantId, EndpointGroupId epgId) {
137         return InstanceIdentifier.builder(Tenants.class)
138             .child(Tenant.class, new TenantKey(tenantId))
139             .child(Policy.class)
140             .child(EndpointGroup.class, new EndpointGroupKey(epgId))
141             .build();
142     }
143
144     public static InstanceIdentifier<Contract> contractIid(TenantId tenantId, ContractId contractId) {
145         return InstanceIdentifier.builder(Tenants.class)
146             .child(Tenant.class, new TenantKey(tenantId))
147             .child(Policy.class)
148             .child(Contract.class, new ContractKey(contractId))
149             .build();
150     }
151
152     public static InstanceIdentifier<Contract> contractWildcardIid(TenantId tenantId) {
153         return InstanceIdentifier.builder(Tenants.class)
154             .child(Tenant.class, new TenantKey(tenantId))
155             .child(Policy.class)
156             .child(Contract.class)
157             .build();
158     }
159
160     public static InstanceIdentifier<Subject> subjectIid(TenantId tenantId, ContractId contractId,
161             SubjectName subjectName) {
162         return InstanceIdentifier.builder(Tenants.class)
163             .child(Tenant.class, new TenantKey(tenantId))
164             .child(Policy.class)
165             .child(Contract.class, new ContractKey(contractId))
166             .child(Subject.class, new SubjectKey(subjectName))
167             .build();
168     }
169
170     public static InstanceIdentifier<ProviderNamedSelector> providerNamedSelectorIid(TenantId tenantId,
171             EndpointGroupId epgId, SelectorName providerSelectorName) {
172         return InstanceIdentifier.builder(Tenants.class)
173             .child(Tenant.class, new TenantKey(tenantId))
174             .child(Policy.class)
175             .child(EndpointGroup.class, new EndpointGroupKey(epgId))
176             .child(ProviderNamedSelector.class, new ProviderNamedSelectorKey(providerSelectorName))
177             .build();
178     }
179
180     public static InstanceIdentifier<ConsumerNamedSelector> consumerNamedSelectorIid(TenantId tenantId,
181             EndpointGroupId epgId, SelectorName consumerSelectorName) {
182         return InstanceIdentifier.builder(Tenants.class)
183             .child(Tenant.class, new TenantKey(tenantId))
184             .child(Policy.class)
185             .child(EndpointGroup.class, new EndpointGroupKey(epgId))
186             .child(ConsumerNamedSelector.class, new ConsumerNamedSelectorKey(consumerSelectorName))
187             .build();
188     }
189
190     public static InstanceIdentifier<Clause> clauseIid(TenantId tenantId, ContractId contractId,
191             ClauseName clauseName) {
192         return InstanceIdentifier.builder(Tenants.class)
193             .child(Tenant.class, new TenantKey(tenantId))
194             .child(Policy.class)
195             .child(Contract.class, new ContractKey(contractId))
196             .child(Clause.class, new ClauseKey(clauseName))
197             .build();
198     }
199
200     public static InstanceIdentifier<Rule> ruleIid(TenantId tenantId, ContractId contractId, SubjectName subjectName,
201             RuleName ruleName) {
202         return InstanceIdentifier.builder(Tenants.class)
203             .child(Tenant.class, new TenantKey(tenantId))
204             .child(Policy.class)
205             .child(Contract.class, new ContractKey(contractId))
206             .child(Subject.class, new SubjectKey(subjectName))
207             .child(Rule.class, new RuleKey(ruleName))
208             .build();
209     }
210
211     public static InstanceIdentifier<ActionInstance> actionInstanceIid(TenantId tenantId, ActionName actionName) {
212         return InstanceIdentifier.builder(Tenants.class)
213             .child(Tenant.class, new TenantKey(tenantId))
214             .child(Policy.class)
215             .child(SubjectFeatureInstances.class)
216             .child(ActionInstance.class, new ActionInstanceKey(actionName))
217             .build();
218     }
219
220     public static InstanceIdentifier<ClassifierInstance> classifierInstanceIid(TenantId tenantId,
221             ClassifierName classifierName) {
222         return InstanceIdentifier.builder(Tenants.class)
223             .child(Tenant.class, new TenantKey(tenantId))
224             .child(Policy.class)
225             .child(SubjectFeatureInstances.class)
226             .child(ClassifierInstance.class, new ClassifierInstanceKey(classifierName))
227             .build();
228     }
229
230     public static InstanceIdentifier<ClassifierDefinition> classifierDefinitionIid(
231             ClassifierDefinitionId classifierDefinitionId) {
232         return InstanceIdentifier.builder(SubjectFeatureDefinitions.class)
233             .child(ClassifierDefinition.class, new ClassifierDefinitionKey(classifierDefinitionId))
234             .build();
235     }
236
237     public static InstanceIdentifier<ActionDefinition> actionDefinitionIid(ActionDefinitionId actionDefinitionId) {
238         return InstanceIdentifier.builder(SubjectFeatureDefinitions.class)
239             .child(ActionDefinition.class, new ActionDefinitionKey(actionDefinitionId))
240             .build();
241     }
242
243     public static InstanceIdentifier<ClassifierRef> classifierRefIid(TenantId tenantId, ContractId contractId,
244             SubjectName subjectName, RuleName ruleName, ClassifierName classifierRefName) {
245         return InstanceIdentifier.builder(Tenants.class)
246             .child(Tenant.class, new TenantKey(tenantId))
247             .child(Policy.class)
248             .child(Contract.class, new ContractKey(contractId))
249             .child(Subject.class, new SubjectKey(subjectName))
250             .child(Rule.class, new RuleKey(ruleName))
251             .child(ClassifierRef.class, new ClassifierRefKey(classifierRefName))
252             .build();
253     }
254
255     public static InstanceIdentifier<L2FloodDomain> l2FloodDomainIid(TenantId tenantId,
256             L2FloodDomainId l2FloodDomainId) {
257         return InstanceIdentifier.builder(Tenants.class)
258             .child(Tenant.class, new TenantKey(tenantId))
259             .child(ForwardingContext.class)
260             .child(L2FloodDomain.class, new L2FloodDomainKey(l2FloodDomainId))
261             .build();
262     }
263
264     public static InstanceIdentifier<L2BridgeDomain> l2BridgeDomainIid(TenantId tenantId,
265             L2BridgeDomainId l2BridgeDomainId) {
266         return InstanceIdentifier.builder(Tenants.class)
267             .child(Tenant.class, new TenantKey(tenantId))
268             .child(ForwardingContext.class)
269             .child(L2BridgeDomain.class, new L2BridgeDomainKey(l2BridgeDomainId))
270             .build();
271     }
272
273     public static InstanceIdentifier<L3Context> l3ContextIid(TenantId tenantId, L3ContextId l3ContextId) {
274         return InstanceIdentifier.builder(Tenants.class)
275             .child(Tenant.class, new TenantKey(tenantId))
276             .child(ForwardingContext.class)
277             .child(L3Context.class, new L3ContextKey(l3ContextId))
278             .build();
279     }
280
281     /**
282      * Get the {@link Endpoint} {@link InstanceIdentifier} based on the {@link EndpointKey}
283      *
284      * @param endpointKey The {@link EndpointKey} of a particular {@link Endpoint}
285      * @return The {@link InstanceIdentifier} of the {@link Endpoint}
286      */
287     public static InstanceIdentifier<Endpoint> endpointIid(EndpointKey endpointKey) {
288         return InstanceIdentifier.builder(Endpoints.class).child(Endpoint.class, endpointKey).build();
289     }
290
291     public static InstanceIdentifier<Endpoint> endpointIid(L2BridgeDomainId l2Context, MacAddress macAddress) {
292         return IidFactory.endpointIid(new EndpointKey(l2Context, macAddress));
293     }
294
295     public static InstanceIdentifier<EndpointL3> l3EndpointIid(EndpointL3Key endpointL3Key) {
296         return InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class, endpointL3Key).build();
297     }
298
299     public static InstanceIdentifier<EndpointL3> l3EndpointIid(L3ContextId l3Context, IpAddress ipAddress) {
300         return IidFactory.l3EndpointIid(new EndpointL3Key(ipAddress, l3Context));
301     }
302
303     public static InstanceIdentifier<EndpointL3> l3EndpointsIidWildcard() {
304         return InstanceIdentifier.builder(Endpoints.class).child(EndpointL3.class).build();
305     }
306
307     public static InstanceIdentifier<EndpointL3Prefix> endpointL3PrefixIid(L3ContextId l3Context, IpPrefix ipPrefix) {
308         return InstanceIdentifier.builder(Endpoints.class)
309             .child(EndpointL3Prefix.class, new EndpointL3PrefixKey(ipPrefix, l3Context))
310             .build();
311     }
312
313     public static InstanceIdentifier<Endpoints> endpointsIidWildcard() {
314         return ENDPOINTS_IID;
315     }
316
317     public static InstanceIdentifier<Subnet> subnetIid(TenantId tenantId, SubnetId subnetId) {
318         return InstanceIdentifier.builder(Tenants.class)
319             .child(Tenant.class, new TenantKey(tenantId))
320             .child(ForwardingContext.class)
321             .child(Subnet.class, new SubnetKey(subnetId))
322             .build();
323     }
324
325     public static InstanceIdentifier<Subnet> subnetWildcardIid(TenantId tenantId) {
326         return InstanceIdentifier.builder(Tenants.class)
327             .child(Tenant.class, new TenantKey(tenantId))
328             .child(ForwardingContext.class)
329             .child(Subnet.class)
330             .build();
331     }
332
333     public static InstanceIdentifier<FollowedEndpointGroup> followedEndpointgroupIid(RendererName rendererName,
334             TenantId tenantId, EndpointGroupId epgId) {
335         return InstanceIdentifier.builder(Renderers.class)
336             .child(Renderer.class, new RendererKey(rendererName))
337             .child(Interests.class)
338             .child(FollowedTenants.class)
339             .child(FollowedTenant.class, new FollowedTenantKey(tenantId))
340             .child(FollowedEndpointGroup.class, new FollowedEndpointGroupKey(epgId))
341             .build();
342     }
343
344     public static InstanceIdentifier<SupportedActionDefinition> supportedActionDefinitionIidWildcard() {
345         return InstanceIdentifier.builder(Renderers.class)
346             .child(Renderer.class)
347             .child(Capabilities.class)
348             .child(SupportedActionDefinition.class)
349             .build();
350     }
351
352     public static InstanceIdentifier<SupportedClassifierDefinition> supportedClassifierDefinitionIidWildcard() {
353         return InstanceIdentifier.builder(Renderers.class)
354             .child(Renderer.class)
355             .child(Capabilities.class)
356             .child(SupportedClassifierDefinition.class)
357             .build();
358     }
359
360     public static InstanceIdentifier<StatisticRecord> statisticRecordIid(StatisticRecordKey key) {
361         return InstanceIdentifier.builder(StatisticsStore.class).child(StatisticRecord.class, key).build();
362     }
363
364     public static InstanceIdentifier<FollowedTenant> followedTenantIid(RendererName rendererName, TenantId tenantId) {
365         return InstanceIdentifier.builder(Renderers.class)
366             .child(Renderer.class, new RendererKey(rendererName))
367             .child(Interests.class)
368             .child(FollowedTenants.class)
369             .child(FollowedTenant.class, new FollowedTenantKey(tenantId))
370             .build();
371     }
372
373     public static InstanceIdentifier<Renderer> rendererIid(RendererName rendererName) {
374         return InstanceIdentifier.builder(Renderers.class).child(Renderer.class, new RendererKey(rendererName)).build();
375     }
376
377     public static InstanceIdentifier<Renderers> renderersIid() {
378         return InstanceIdentifier.builder(Renderers.class).build();
379     }
380
381     public static InstanceIdentifier<ExternalImplicitGroup> externalImplicitGroupIid(TenantId tenantId,
382             EndpointGroupId epgId) {
383         return InstanceIdentifier.builder(Tenants.class)
384             .child(Tenant.class, new TenantKey(tenantId))
385             .child(Policy.class)
386             .child(ExternalImplicitGroup.class, new ExternalImplicitGroupKey(epgId))
387             .build();
388     }
389
390     public static InstanceIdentifier<ContainmentEndpoint> containmentEndpointIid(ContainmentEndpointKey key) {
391         return InstanceIdentifier
392             .builder(
393                     org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.Endpoints.class)
394             .child(ContainmentEndpoints.class)
395             .child(ContainmentEndpoint.class, key)
396             .build();
397     }
398
399     public static InstanceIdentifier<AddressEndpoint> addressEndpointIid(AddressEndpointKey addressEndpointKey) {
400         return InstanceIdentifier
401             .builder(
402                     org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.Endpoints.class)
403             .child(AddressEndpoints.class)
404             .child(AddressEndpoint.class, addressEndpointKey)
405             .build();
406     }
407
408     public static InstanceIdentifier<ParentContainmentEndpoint> parentContainmentEndpointIid(
409             AddressEndpointKey addressEndpointKey, ParentContainmentEndpointKey parentContainmentEndpointKey) {
410         return InstanceIdentifier
411             .builder(
412                     org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.Endpoints.class)
413             .child(AddressEndpoints.class)
414             .child(AddressEndpoint.class, addressEndpointKey)
415             .child(ParentContainmentEndpoint.class, parentContainmentEndpointKey)
416             .build();
417     }
418
419     public static InstanceIdentifier<AddressEndpointLocation> addressEndpointLocationIid(AddressEndpointLocationKey addrEndpointLocationKey) {
420         return InstanceIdentifier.builder(EndpointLocations.class)
421                 .child(AddressEndpointLocation.class, addrEndpointLocationKey)
422                 .build();
423     }
424
425     public static InstanceIdentifier<ContainmentEndpointLocation> containmentEndpointLocationIid(ContainmentEndpointLocationKey addrEndpointLocationKey) {
426         return InstanceIdentifier.builder(EndpointLocations.class)
427                 .child(ContainmentEndpointLocation.class, addrEndpointLocationKey)
428                 .build();
429     }
430
431     public static InstanceIdentifier<InternalLocation> internalLocationIid(AddressEndpointLocationKey addrEndpointLocationKey,
432             InternalLocationKey internalLocationKey) {
433         return InstanceIdentifier.builder(EndpointLocations.class)
434                 .child(AddressEndpointLocation.class, addrEndpointLocationKey)
435                 .child(RelativeLocations.class)
436                 .child(InternalLocation.class, internalLocationKey)
437                 .build();
438     }
439
440     public static InstanceIdentifier<InternalLocation> internalLocationIid(ContainmentEndpointLocationKey contEndpointLocationKey,
441             InternalLocationKey internalLocationKey) {
442         return InstanceIdentifier.builder(EndpointLocations.class)
443                 .child(ContainmentEndpointLocation.class, contEndpointLocationKey)
444                 .child(RelativeLocations.class)
445                 .child(InternalLocation.class, internalLocationKey)
446                 .build();
447     }
448
449     public static InstanceIdentifier<ExternalLocation> externalLocationIid(AddressEndpointLocationKey addrEndpointLocationKey,
450             ExternalLocationKey externalLocationKey) {
451         return InstanceIdentifier.builder(EndpointLocations.class)
452                 .child(AddressEndpointLocation.class, addrEndpointLocationKey)
453                 .child(RelativeLocations.class)
454                 .child(ExternalLocation.class, externalLocationKey)
455                 .build();
456     }
457
458     public static InstanceIdentifier<ExternalLocation> externalLocationIid(ContainmentEndpointLocationKey contEndpointLocationKey,
459             ExternalLocationKey externalLocationKey) {
460         return InstanceIdentifier.builder(EndpointLocations.class)
461                 .child(ContainmentEndpointLocation.class, contEndpointLocationKey)
462                 .child(RelativeLocations.class)
463                 .child(ExternalLocation.class, externalLocationKey)
464                 .build();
465     }
466
467     public static InstanceIdentifier<AbsoluteLocation> absoluteLocationIid(AddressEndpointLocationKey addrEndpointLocationKey) {
468         return InstanceIdentifier.builder(EndpointLocations.class)
469                 .child(AddressEndpointLocation.class, addrEndpointLocationKey)
470                 .child(AbsoluteLocation.class)
471                 .build();
472     }
473
474     public static InstanceIdentifier<ProviderAddressEndpointLocation> providerAddressEndpointLocationIid(String provider,
475             Class<? extends AddressType> addrType, String addr, Class<? extends ContextType> cType,
476             ContextId containment) {
477         return InstanceIdentifier.builder(LocationProviders.class)
478                 .child(LocationProvider.class, new LocationProviderKey(new ProviderName(provider)))
479             .child(ProviderAddressEndpointLocation.class, new ProviderAddressEndpointLocationKey(addr, addrType, containment, cType))
480             .build();
481     }
482 }