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