module base-endpoint {
yang-version 1;
- namespace "urn:opendaylight:groupbasedpolicy:endpoints";
+ namespace "urn:opendaylight:groupbasedpolicy:base_endpoint";
prefix "base-endpoint";
import gbp-common { prefix gbp-common; revision-date 2014-04-21; }
}
grouping address-endpoint-key {
+ uses forwarding:context-key;
uses forwarding:has-address-type;
leaf address {
type string;
}
}
- grouping endpoint-key {
- uses forwarding:context-key;
- uses address-endpoint-key;
- }
-
grouping has-child-endpoints {
list child-endpoint {
key "context-type context-id address-type address";
- uses endpoint-key;
+ uses address-endpoint-key;
}
}
case parent-endpoint-case {
list parent-endpoint {
key "context-type context-id address-type address";
- uses endpoint-key;
+ uses address-endpoint-key;
}
}
}
}
}
+ grouping address-endpoint-fields {
+ uses address-endpoint-key;
+ uses parent-child-endpoints;
+ uses common-endpoint-fields;
+ }
+
+ grouping containment-endpoint-fields {
+ uses forwarding:context-key;
+ uses has-child-endpoints;
+ uses common-endpoint-fields;
+ }
+
grouping has-endpoint-group-conditions {
description
"Base type for object with endpoint group to condition mappings.";
for policy resolution.";
config false;
- list address-endpoints-by-containment {
- key "context-type context-id";
- uses forwarding:context-key;
-
+ container address-endpoints {
list address-endpoint {
- key "address-type address";
- uses address-endpoint-key;
-
- uses parent-child-endpoints;
- uses common-endpoint-fields;
- min-elements 1;
+ key "context-type context-id address-type address";
+ uses address-endpoint-fields;
}
}
- list containment-endpoint {
- key "context-type context-id";
- uses forwarding:context-key;
-
- uses has-child-endpoints;
- uses common-endpoint-fields;
+ container containment-endpoints {
+ list containment-endpoint {
+ key "context-type context-id";
+ uses containment-endpoint-fields;
+ }
}
}
container endpoint-locations {
list address-endpoint-location {
key "context-type context-id address-type address";
- uses endpoint-key;
+ uses address-endpoint-key;
uses has-location;
}
input {
list address-endpoint-reg {
key "context-type context-id address-type address";
- uses endpoint-key;
-
- uses parent-child-endpoints;
- uses common-endpoint-fields;
+ uses address-endpoint-fields;
uses has-location;
}
list containment-endpoint-reg {
key "context-type context-id";
- uses forwarding:context-key;
-
- uses has-child-endpoints;
- uses common-endpoint-fields;
+ uses containment-endpoint-fields;
uses has-location;
}
}
input {
list address-endpoint-unreg {
key "context-type context-id address-type address";
- uses endpoint-key;
+ uses address-endpoint-key;
}
list containment-endpoint-unreg {
key "context-type context-id";
* and is available at http://www.eclipse.org/legal/epl-v10.html\r
*/\r
\r
-module endpoint-locations {\r
+module endpoint-location-provider {\r
yang-version 1;\r
\r
- namespace "urn:opendaylight:groupbasedpolicy:endpoint:location";\r
- prefix "endpoints-location";\r
+ namespace "urn:opendaylight:groupbasedpolicy:endpoint_location_provider";\r
+ prefix "ep-loc-provider";\r
\r
import base-endpoint { prefix base-endpoint; revision-date 2016-04-27; }\r
import forwarding { prefix forwarding; revision-date 2016-04-27; }\r
type string;\r
}\r
\r
- container endpoint-locations {\r
+ container location-providers {\r
list location-provider {\r
key "provider";\r
leaf provider {\r
type provider-name;\r
}\r
- list endpoint-location {\r
+ list provider-address-endpoint-location {\r
key "context-type context-id address-type address";\r
- uses base-endpoint:endpoint-key;\r
+ uses base-endpoint:address-endpoint-key;\r
uses base-endpoint:has-location;\r
}\r
- list containment-endpoint-location {\r
+ list provider-containment-endpoint-location {\r
key "context-type context-id";\r
uses forwarding:context-key;\r
uses base-endpoint:has-location;\r
}
}
- container forwarding {
- list forwarding-by-tenant {
- key tenant-id;
- leaf tenant-id {
- type gbp-common:tenant-id;
- description
- "The tenant with which forwarding-context is associated";
- }
+ grouping forwarding-with-tenant-fields {
+ leaf tenant-id {
+ type gbp-common:tenant-id;
+ description
+ "The tenant with which forwarding-context is associated";
+ }
- list forwarding-context {
- key "context-type context-id";
- uses context-key;
+ list forwarding-context {
+ key "context-type context-id";
+ uses context-key;
- uses has-address-type;
- container parent {
- uses context-key;
- }
+ uses has-address-type;
+ container parent {
+ uses context-key;
}
+ }
- list network-domain {
- key "network-domain-type network-domain-id";
- uses network-domain-key;
-
- container parent {
- uses context-key;
- }
+ list network-domain {
+ key "network-domain-type network-domain-id";
+ uses network-domain-key;
- description "Network domain can be augmented with further information.";
+ container parent {
+ uses context-key;
}
+
+ description "Network domain can be augmented with further information.";
+ }
+ }
+
+ container forwarding {
+ list forwarding-by-tenant {
+ key tenant-id;
+ uses forwarding-with-tenant-fields;
}
}
}
identity ip-prefix-type {
- description "Values by IP prefix type MUST be compatible with type ietf-inet-types:ipv-prefix.
+ description "Values by IP prefix type MUST be compatible with type ietf-inet-types:ip-prefix.
This address type can be used only if forwarding:context-type is l3-context.";
base forwarding:address-type;
}
namespace "urn:opendaylight:groupbasedpolicy:renderer";
prefix "gbp-renderer";
- import gbp-common {
- prefix gbp-common;
- revision-date 2014-04-21;
- }
- import policy {
- prefix policy;
- revision-date 2014-04-21;
- }
- import ietf-inet-types {
- prefix inet;
- revision-date 2010-09-24;
- }
+ import gbp-common { prefix gbp-common; revision-date 2014-04-21; }
+ import policy { prefix policy; revision-date 2014-04-21; }
+ import resolved-policy { prefix resolved-policy; revision-date 2015-08-28; }
+ import base-endpoint { prefix base-endpoint; revision-date 2016-04-27; }
+ import forwarding { prefix forwarding; revision-date 2016-04-27; }
+ import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
description
"This module defines renderer capabilities.";
description "A name for a renderer";
}
+ typedef policy-name {
+ type string;
+ }
+
+ typedef endpoint-policy-participation {
+ type enumeration {
+ enum PROVIDER;
+ enum CONSUMER;
+ }
+ }
+
grouping supported-string-value-fields {
list supported-string-value {
description "String value has to be identical.";
}
}
+ grouping has-peer-endpoints {
+ list peer-endpoint {
+ key "context-type context-id address-type address";
+ uses base-endpoint:address-endpoint-key;
+ }
+ }
+
+ grouping has-peer-containment-endpoints {
+ list peer-containment-endpoint {
+ key "context-type context-id";
+ uses forwarding:context-key;
+ }
+ }
+
+ grouping has-peer-external-endpoints {
+ list peer-external-endpoint {
+ key "context-type context-id address-type address";
+ uses base-endpoint:address-endpoint-key;
+ }
+ }
+
+ grouping has-peer-external-containment-endpoints {
+ list peer-external-containment-endpoint {
+ key "context-type context-id";
+ uses forwarding:context-key;
+ }
+ }
+
+ grouping has-renderer-name {
+ leaf renderer-name {
+ type renderer-name;
+ mandatory true;
+ }
+ }
+
container renderers {
description
"Leaf containing all renderers' description.";
- config false;
-
list renderer {
description
- "A renderer provides a list of capabilities.";
+ "A renderer provides a list of capabilities and status about configured policy.
+ The renderer must store data only to OPER!";
key name;
-
leaf name {
description
"A user-visible name for the renderer.";
type renderer-name;
}
+ container renderer-nodes {
+ description "Contains location of nodes (network elements) which are configured by the renderer.";
+
+ config false;
+
+ list renderer-node {
+ key "node-path";
+ leaf node-path {
+ description "Path to the node where policy needs to be enforced.";
+ type instance-identifier;
+ }
+ }
+ }
+
+ container renderer-policy {
+ description "Policy is named by version and describes desired vs real state.
+ Desired state of policy described by /renderers/renderer/renderer-policy/configuration and version are stored in CONF.
+ The real state of policy described by /renderers/renderer/renderer-policy/status and version are stored in OPER.";
+
+ leaf version {
+ description
+ "Version in CONF represents desired state of policy while version in OPER means real state.";
+ type uint32;
+ mandatory true;
+ }
+
+ container configuration {
+ description "Renderer tries to apply given policy on devices.";
+ container endpoint-resolved-policies {
+ list endpoint-resolved-policy {
+ description "Policy between renderer-endpoints and peer-endpoints.";
+ key policy-name;
+ leaf policy-name {
+ description "Key is here only as workaround for bugs around unkeyed list. It can be removed anytime.";
+ type policy-name;
+ }
+
+ container resolved-policy {
+ list rule-group-with-renderer-endpoint-participation {
+ description "A specific policy rule group that apply to pair of endpoints.
+ Entire rule-group is located on /renderers/renderer/renderer-policy/configuration/rule-groups/rule-group";
+ key "tenant-id contract-id subject-name renderer-endpoint-participation";
+ uses resolved-policy:has-subject-key;
+ leaf renderer-endpoint-participation {
+ type endpoint-policy-participation;
+ }
+ }
+ }
+
+ container renderer-endpoints-and-peers {
+ description "Every renderer-endpoint has the same set of peer-endpoints.
+ A renderer should not configure a policy when renderer-endpoint is peer-endpoint.";
+ list renderer-endpoint {
+ key "context-type context-id address-type address";
+ uses base-endpoint:address-endpoint-key;
+ }
+ uses has-peer-endpoints;
+ uses has-peer-external-endpoints;
+ uses has-peer-external-containment-endpoints;
+ }
+ }
+ }
+
+ container rule-groups {
+ list rule-group {
+ description "A specific policy rule group that apply to pair of endpoints.
+ The policy rule group represents the subject with resolved rules.";
+ key "tenant-id contract-id subject-name";
+ uses resolved-policy:has-subject-key;
+
+ uses policy:has-order;
+ uses resolved-policy:has-resolved-rules;
+ }
+ }
+
+ container endpoints {
+ list address-endpoint-with-location {
+ key "context-type context-id address-type address";
+ uses base-endpoint:address-endpoint-fields;
+ uses base-endpoint:has-location;
+ uses has-renderer-name;
+ }
+
+ list containment-endpoint-with-location {
+ key "context-type context-id";
+ uses base-endpoint:address-endpoint-fields;
+ uses base-endpoint:has-location;
+ }
+ }
+
+ container forwarding-contexts {
+ list forwarding-context-by-tenant {
+ key tenant-id;
+ uses forwarding:forwarding-with-tenant-fields;
+ }
+ }
+ }
+
+ container status {
+ description "The renderer exposes status of policy here.";
+ config false;
+
+ list unconfigured-rule {
+ key "tenant-id contract-id subject-name renderer-endpoint-participation rule-name";
+ uses resolved-policy:has-subject-key;
+ leaf renderer-endpoint-participation {
+ type endpoint-policy-participation;
+ }
+ leaf rule-name {
+ type gbp-common:rule-name;
+ }
+
+ container renderer-endpoints-with-peers {
+ list renderer-endpoint-with-peers {
+ key "context-type context-id address-type address";
+ uses base-endpoint:address-endpoint-key;
+
+ uses has-peer-endpoints;
+ uses has-peer-external-endpoints;
+ uses has-peer-external-containment-endpoints;
+ }
+ }
+ }
+ }
+ }
+
+ // TODO remove - does not make sense anymore
container interests {
+
+ status deprecated;
+
+ config false;
+
description "Represents interests of the renderer.";
container followed-tenants {
}
}
-
container capabilities {
+
+ config false;
+
description "Capabilities this renderer provides.";
list supported-classifier-definition {
import org.opendaylight.groupbasedpolicy.sxp.mapper.impl.listen.EPPolicyTemplateListenerImpl;
import org.opendaylight.groupbasedpolicy.sxp.mapper.impl.listen.MasterDatabaseBindingListenerImpl;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.BaseEndpointService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.BaseEndpointService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.EndpointForwardingTemplateBySubnet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.EndpointPolicyTemplateBySgt;
import org.opendaylight.yang.gen.v1.urn.opendaylight.sxp.database.rev160308.Sgt;
package org.opendaylight.groupbasedpolicy.sxp.mapper.impl;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.AsyncFunction;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
-import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.groupbasedpolicy.sxp.mapper.api.SxpMapperReactor;
import org.opendaylight.groupbasedpolicy.sxp.mapper.impl.util.SxpListenerUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.BaseEndpointService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.Endpoints;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.common.endpoint.fields.NetworkContainment;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.common.endpoint.fields.NetworkContainmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.AddressEndpoints;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpoint;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpointKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.register.endpoint.input.AddressEndpointReg;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.register.endpoint.input.AddressEndpointRegBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.common.rev140421.ContextId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.BaseEndpointService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.Endpoints;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.RegisterEndpointInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.RegisterEndpointInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.common.endpoint.fields.NetworkContainment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.common.endpoint.fields.NetworkContainmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.endpoints.AddressEndpointsByContainment;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.endpoints.AddressEndpointsByContainmentKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.endpoints.address.endpoints.by.containment.AddressEndpoint;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.endpoints.address.endpoints.by.containment.AddressEndpointKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.register.endpoint.input.AddressEndpointReg;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.register.endpoint.input.AddressEndpointRegBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.l2_l3.rev160427.IpPrefixType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.forwarding.l2_l3.rev160427.L3Context;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.EndpointForwardingTemplateBySubnet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.AsyncFunction;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+
/**
* Purpose: exclusively processes sxp master database changes and EGP templates changes
*/
private CheckedFuture<Optional<AddressEndpoint>, ReadFailedException> findExistingEndPoint(final ContextId containment,
final String address) {
KeyedInstanceIdentifier<AddressEndpoint, AddressEndpointKey> addressEndpointPath =
- InstanceIdentifier.create(Endpoints.class)
- .child(AddressEndpointsByContainment.class, new AddressEndpointsByContainmentKey(containment, L3Context.class))
- .child(AddressEndpoint.class, new AddressEndpointKey(address, IpPrefixType.class));
+ InstanceIdentifier.create(Endpoints.class).child(AddressEndpoints.class).child(AddressEndpoint.class,
+ new AddressEndpointKey(address, IpPrefixType.class, containment, L3Context.class));
final ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction();
final CheckedFuture<Optional<AddressEndpoint>, ReadFailedException> read = rTx.read(
LogicalDatastoreType.OPERATIONAL, addressEndpointPath);
*/
package org.opendaylight.groupbasedpolicy.sxp.mapper.impl;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.Futures;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.BaseEndpointService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.RegisterEndpointInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoints.rev160427.endpoints.address.endpoints.by.containment.AddressEndpoint;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.BaseEndpointService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.RegisterEndpointInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpoint;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.EndpointForwardingTemplateBySubnet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.EndpointPolicyTemplateBySgt;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.groupbasedpolicy.sxp.mapper.model.rev160302.sxp.mapper.endpoint.forwarding.template.by.subnet.NetworkContainment;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
+
/**
* Test for {@link SxpMapperReactorImpl}.
*/