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