</dependency>
</dependencies>
- <!-- Project reporting -->
- <reporting>
- <plugins>
- <!-- Code coverage analysis -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- </plugins>
- </reporting>
-
<!-- project build -->
<build>
<plugins>
<manifestLocation>${project.basedir}/META-INF</manifestLocation>
</configuration>
</plugin>
- <!-- Code coverage analysis -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <instrumentation>
- <excludes>
- <exclude>org/opendaylight/yang/**/*.class</exclude>
- <exclude>org/opendaylight/controller/config/yang/**/*.class</exclude>
- </excludes>
- </instrumentation>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
- <!-- needed for cobertura -->
+ <!-- needed for cobertura -->
<argLine>-XX:-UseSplitVerifier</argLine>
</configuration>
</plugin>
</execution>
</executions>
</plugin>
+ <!-- Code coverage analysis -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <instrumentation>
+ <excludes>
+ <exclude>org/opendaylight/yang/**/*.class</exclude>
+ <exclude>org/opendaylight/controller/config/yang/**/*.class</exclude>
+ </excludes>
+ </instrumentation>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
+
+ <!-- Project reporting -->
+ <reporting>
+ <plugins>
+ <!-- Code coverage analysis -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Key;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.has.endpoint.group.conditions.EndpointGroupCondition;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.has.endpoint.group.conditions.EndpointGroupConditionKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.unregister.endpoint.input.L2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.unregister.endpoint.input.L3;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
.build();
EndpointKey key =
- new EndpointKey(ep.getL2Namespace(), ep.getMacAddress());
+ new EndpointKey(ep.getL2Context(), ep.getMacAddress());
InstanceIdentifier<Endpoint> iid =
InstanceIdentifier.builder(Endpoints.class)
.child(Endpoint.class, key)
for (L3Address l3addr : input.getL3Address()) {
t = dataProvider.beginTransaction();
EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(),
- l3addr.getL3Namespace());
+ l3addr.getL3Context());
EndpointL3 ep3 = new EndpointL3Builder(input)
.setIpAddress(key3.getIpAddress())
- .setL3Namespace(l3addr.getL3Namespace())
+ .setL3Context(l3addr.getL3Context())
.setTimestamp(timestamp)
.build();
InstanceIdentifier<EndpointL3> iid_l3 =
@Override
public Future<RpcResult<Void>>
unregisterEndpoint(UnregisterEndpointInput input) {
- EndpointKey key =
- new EndpointKey(input.getL2Namespace(), input.getMacAddress());
- InstanceIdentifier<Endpoint> iid =
- InstanceIdentifier.builder(Endpoints.class)
- .child(Endpoint.class, key).build();
- DataObject dao = dataProvider.readOperationalData(iid);
-
Collection<RpcError> errors = new ArrayList<>();
-
- if (dao != null && dao instanceof Endpoint) {
- Endpoint ep = (Endpoint)dao;
-
- if (ep.getL3Address() != null) {
- for (L3Address l3addr : ep.getL3Address()) {
- EndpointL3Key key3 =
- new EndpointL3Key(l3addr.getIpAddress(),
- l3addr.getL3Namespace());
- InstanceIdentifier<EndpointL3> iid_l3 =
- InstanceIdentifier.builder(Endpoints.class)
- .child(EndpointL3.class, key3)
- .build();
- DataModificationTransaction t =
- dataProvider.beginTransaction();
- t.removeOperationalData(iid_l3);
- docommit(t, iid_l3.toString(), "unregister", errors);
- }
- }
-
+
+ for (L2 l2a : input.getL2()) {
+ EndpointKey key =
+ new EndpointKey(l2a.getL2Context(),
+ l2a.getMacAddress());
+ InstanceIdentifier<Endpoint> iid =
+ InstanceIdentifier.builder(Endpoints.class)
+ .child(Endpoint.class, key).build();
DataModificationTransaction t =
dataProvider.beginTransaction();
t.removeOperationalData(iid);
docommit(t, iid.toString(), "unregister", errors);
}
+ if (input.getL3() != null) {
+ for (L3 l3addr : input.getL3()) {
+ EndpointL3Key key3 =
+ new EndpointL3Key(l3addr.getIpAddress(),
+ l3addr.getL3Context());
+ InstanceIdentifier<EndpointL3> iid_l3 =
+ InstanceIdentifier.builder(Endpoints.class)
+ .child(EndpointL3.class, key3)
+ .build();
+ DataModificationTransaction t =
+ dataProvider.beginTransaction();
+ t.removeOperationalData(iid_l3);
+ docommit(t, iid_l3.toString(), "unregister", errors);
+ }
+ }
+
// note that deleting an object that doesn't exist is fine.
RpcResult<Void> result = Rpcs.<Void>getRpcResult(errors.isEmpty(),
errors);
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ContractId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.EndpointGroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.LabelName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.NetworkDomainId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.QualityMatcherName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.QualityName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.RequirementMatcherName;
.setContract(ImmutableList.copyOf(resolvedContracts.values()))
.setContractRef(unresolvedTenant.getContractRef())
.setSubjectFeatureInstances(unresolvedTenant.getSubjectFeatureInstances())
+ .setL3Context(unresolvedTenant.getL3Context())
+ .setL2BridgeDomain(unresolvedTenant.getL2BridgeDomain())
+ .setL2FloodDomain(unresolvedTenant.getL2FloodDomain())
+ .setSubnet(unresolvedTenant.getSubnet())
.build();
}
new HashMap<>();
HashMap<SelectorName, ProviderNamedSelector> resolvedPns =
new HashMap<>();
+ NetworkDomainId domain = unresolvedEg.getNetworkDomain();
if (unresolvedEg.getConsumerTargetSelector() != null) {
for (ConsumerTargetSelector s : unresolvedEg.getConsumerTargetSelector()) {
resolvePns(unresolvedTenant, unresolvedEg, s, resolvedPns);
}
}
+
if (parent != null) {
if (parent.getConsumerTargetSelector() != null) {
resolvedPns.put(pns.getName(), pns);
}
}
+ if (domain == null) {
+ domain = parent.getNetworkDomain();
+ }
}
// Note: do not set parent, or any of the values that only exist
.setConsumerNamedSelector(ImmutableList.copyOf(resolvedCns.values()))
.setProviderTargetSelector(ImmutableList.copyOf(resolvedPts.values()))
.setProviderNamedSelector(ImmutableList.copyOf(resolvedPns.values()))
+ .setNetworkDomain(domain)
.build();
resolvedEgs.put(resolvedEg.getId(), resolvedEg);
}
// Unique object IDs
// *****************
- typedef l2-namespace-id {
+ typedef network-domain-id {
type unique-id;
- description "An unique ID for a layer 2 namespace";
+ description "A unique ID for a network domain";
+ }
+
+ typedef subnet-id {
+ type network-domain-id;
+ description "A unique ID for a subnet";
}
- typedef l3-namespace-id {
- type unique-id;
- description "A unique ID for a layer 3 namespace";
+ typedef context-id {
+ type network-domain-id;
+ description "A unique ID for a forwarding context";
+ }
+
+ typedef l2-context-id {
+ type context-id;
+ description "A unique ID for a layer 2 context";
+ }
+
+ typedef l2-bridge-domain-id {
+ type l2-context-id;
+ description "A unique ID for a bridge domain";
+ }
+
+ typedef l2-flood-domain-id {
+ type l2-context-id;
+ description "A unique ID for a flood domain";
+ }
+
+ typedef l3-context-id {
+ type context-id;
+ description "A unique ID for a layer 3 context";
}
typedef tenant-id {
"Initial revision.";
}
- // A base type for an end point
- grouping endpoint-fields {
- description "An endpoint and its associated metadata";
- leaf tenant {
- type gbp-common:tenant-id;
+ grouping l2-key {
+ description
+ "The fields that identify an endpoint by a layer 2 address";
+ leaf l2-context {
+ type gbp-common:l2-context-id;
+ description
+ "The context for the layer 2 address for this endpoint";
+ }
+ leaf mac-address {
+ type yang:mac-address;
+ description
+ "The MAC address for the endpoint";
+ }
+ }
+
+ grouping l3-key {
+ description
+ "The fields that identify an endpoint by a layer 3 address";
+ leaf l3-context {
+ type gbp-common:l3-context-id;
mandatory true;
description
- "The tenant with which this endpoint is associated";
+ "The context for this layer 3 address";
}
- leaf l2-namespace {
- type gbp-common:l2-namespace-id;
+ leaf ip-address {
+ type inet:ip-address;
mandatory true;
description
- "The namespace for the layer 2 address for this endpoint";
+ "The actual IP address for the endpoint";
}
- leaf mac-address {
- type yang:mac-address;
+ }
+
+ // A base type for an end point
+ grouping endpoint-fields {
+ description "An endpoint and its associated metadata";
+ leaf tenant {
+ type gbp-common:tenant-id;
mandatory true;
description
- "The MAC address for the endpoint";
+ "The tenant with which this endpoint is associated";
}
+
+ uses l2-key;
+
list l3-address {
description
"All the layer 3 addresses associated with this endpoint";
- key "l3-namespace ip-address";
- leaf l3-namespace {
- type gbp-common:l3-namespace-id;
- mandatory true;
- description
- "The namespace for this layer 3 address";
- }
- leaf ip-address {
- type inet:ip-address;
- mandatory true;
- description
- "The actual IP address for the endpoint";
- }
+ key "l3-context ip-address";
+ uses l3-key;
leaf ip-prefix {
type inet:ip-prefix;
description
"Endpoints indexed by layer 2 addreses. When modifying
data here, you must also modify data in the
endpoints-l3 list as well.";
- key "l2-namespace mac-address";
+ key "l2-context mac-address";
uses endpoint-fields;
}
data here, you must also modify data in the endpoints
list as well.";
- key "l3-namespace ip-address";
+ key "l3-context ip-address";
- leaf l3-namespace {
- type gbp-common:l3-namespace-id;
+ leaf l3-context {
+ type gbp-common:l3-context-id;
mandatory true;
description
- "The namespace for this layer 3 address";
+ "The context for this layer 3 address";
}
leaf ip-address {
type inet:ip-address;
}
rpc unregister-endpoint {
- description "Unregister an endpoint from the registry.";
+ description "Unregister an endpoint or endpoints from the registry.";
input {
- leaf l2-namespace {
- type gbp-common:l2-namespace-id;
- mandatory true;
- description
- "The namespace for the layer 2 address for this endpoint";
+ list l2 {
+ key "l2-context mac-address";
+ uses l2-key;
}
- leaf mac-address {
- type yang:mac-address;
- mandatory true;
- description
- "The MAC address for the endpoint";
+ list l3 {
+ key "l3-context ip-address";
+ uses l3-key;
}
}
}
prefix "gbp-policy";
import gbp-common {prefix gbp-common;}
+ import ietf-inet-types {prefix inet;}
description
"This module defines the group-based policy configuration
}
}
+ // ************************
+ // Network domains grouping
+ // ************************
+
+ grouping network-domain {
+ description
+ "A base type for network domains. Network domains
+ represent some logical grouping or namespace of
+ network addresses.";
+ leaf name {
+ description
+ "A human-readable name for the network domain.";
+ type gbp-common:name;
+ }
+ leaf description {
+ description
+ "A human-readable description for the context.";
+ type gbp-common:description;
+ }
+ }
+
+ grouping forwarding-context {
+ description "A base type for forwarding contexts.";
+ uses network-domain;
+ }
+
+ grouping l2-context {
+ description
+ "A base type for layer 2 contexts. Layer 2 contexts
+ represent a namespace or logical grouping of layer 2
+ addresses.";
+
+ uses forwarding-context;
+ }
+
// ************************
// Endpoint group groupings
// ************************
type gbp-common:description;
}
+ // ***************
+ // Network domains
+ // ***************
+
+ list l3-context {
+ description
+ "A layer 3 context represents a namespace for layer 3
+ addresses. It represents a domain inside which endpoints
+ can communicate with requiring any address translation.";
+
+ key "id";
+ uses forwarding-context;
+
+ leaf id {
+ description
+ "A unique ID for the layer 3 context";
+ type gbp-common:l3-context-id;
+ }
+ }
+
+ list l2-bridge-domain {
+ description
+ "A layer 2 bridge domain represents a domain in which
+ layer 2 communication is possible when allowed by policy.";
+ key "id";
+ uses l2-context;
+
+ leaf id {
+ description "A unique ID for the bridge domain";
+ type gbp-common:l2-bridge-domain-id;
+ }
+
+ leaf parent {
+ description
+ "The layer 3 context that contains this bridge domain";
+ type leafref {
+ path "/tenants/tenant/l3-context/id";
+ }
+ }
+ }
+
+ list l2-flood-domain {
+ description
+ "A layer 2 flood domain represents a domain in which
+ layer 2 broadcast and multicast is allowed.";
+ key "id";
+ uses l2-context;
+
+ leaf id {
+ description "A unique ID for the flood domain";
+ type gbp-common:l2-flood-domain-id;
+ }
+
+ leaf parent {
+ description
+ "The bridge domain that contains this flood domain";
+ type leafref {
+ path "/tenants/tenant/l2-bridge-domain/id";
+ }
+ }
+ }
+
+ list subnet {
+ description
+ "An IP subnet associated with a layer 2 or layer 3
+ context.";
+ key "id";
+ uses network-domain;
+
+ leaf id {
+ description "A unique ID for the subnet";
+ type gbp-common:subnet-id;
+ }
+
+ leaf parent {
+ description
+ "The forwarding context that contains this subnet";
+ type gbp-common:context-id;
+ }
+
+ leaf ip-prefix {
+ description "The IP prefix that defines the subnet";
+ type inet:ip-prefix;
+ }
+ }
+
// ***************
// Endpoint groups
// ***************
uses provider-selection-relator;
}
+ leaf network-domain {
+ description
+ "The network domain associated with this endpoint
+ group. The network domain controls which endpoints
+ are addressible by the endpoints in the group.";
+ type gbp-common:network-domain-id;
+ }
+
leaf parent {
description
"Parent endpoint group from which we inherit";
}
}
}
-
- // XXX - TODO - model forwarding model
-}
+}
\ No newline at end of file