}
}
- grouping has-regular-location {
- leaf node {
+ grouping internal-location-fields {
+ description "Location inside ODL - node and node-connector
+ are represented directly in ODL.";
+ leaf internal-node {
mandatory true;
type instance-identifier;
}
- leaf node-connector {
+ leaf internal-node-connector {
type instance-identifier;
}
}
- grouping has-external-location {
+ grouping external-location-fields {
+ description "Location outside of ODL - node and node-connector
+ are outside of ODL. external-node-mount-point is path
+ to external system where node and node-connector are located.";
leaf external-node-mount-point {
mandatory true;
type instance-identifier;
}
- leaf external-node-location {
+ leaf external-node {
type string; // TODO switch to external-reference
}
leaf external-node-connector {
}
}
- grouping has-location {
- container real-location {
+ grouping has-absolute-location {
+ container absolute-location {
choice location-type {
- case regular-location-case {
- uses has-regular-location;
+ case internal-location-case {
+ uses internal-location-fields;
}
case external-location-case {
- uses has-external-location;
+ uses external-location-fields;
}
}
}
- container relative-location {
- list location {
- key "node node-connector";
- uses has-regular-location;
+ }
+
+ grouping has-relative-location {
+ container relative-locations {
+ list internal-location {
+ key "internal-node internal-node-connector";
+ uses internal-location-fields;
}
list external-location {
key "external-node-mount-point external-node-connector";
- uses has-external-location;
+ uses external-location-fields;
}
}
}
+ grouping has-location {
+ uses has-absolute-location;
+ uses has-relative-location;
+ }
+
container endpoints {
description
"Repository for operational state data about endpoints needed
list containment-endpoint-location {
key "context-type context-id";
uses forwarding:context-key;
- uses has-location;
+ uses has-relative-location;
}
}
list containment-endpoint-reg {
key "context-type context-id";
uses containment-endpoint-fields;
- uses has-location;
+ uses has-relative-location;
}
}
}
import org.opendaylight.groupbasedpolicy.util.NetUtils;
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.base_endpoint.rev160427.endpoints.address.endpoints.AddressEndpoint;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.location.RealLocation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.location.RealLocationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.location.real.location.location.type.RegularLocationCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.AbsoluteLocation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.AbsoluteLocationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.absolute.location.location.type.InternalLocationCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.network.elements.rev160407.NetworkElements;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.network.elements.rev160407.NetworkElementsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.network.elements.rev160407.network.elements.NetworkElement;
&& endpoint.getAddressType().isAssignableFrom(IpPrefixType.class) && NetUtils
.samePrefix(new IpPrefix(endpoint.getAddress().toCharArray()), en.getIpPrefix())) {
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
- InstanceIdentifier<RealLocation> iid = IidFactory
+ InstanceIdentifier<AbsoluteLocation> iid = IidFactory
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
- .child(RealLocation.class)
+ .child(AbsoluteLocation.class)
.build();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, createRealLocation(ne.getIid(), iface.getIid()),
true);
&& endpoint.getAddressType().isAssignableFrom(IpPrefixType.class) && NetUtils
.samePrefix(new IpPrefix(endpoint.getAddress().toCharArray()), en.getIpPrefix())) {
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
- InstanceIdentifier<RealLocation> iid = IidFactory
+ InstanceIdentifier<AbsoluteLocation> iid = IidFactory
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
- .child(RealLocation.class)
+ .child(AbsoluteLocation.class)
.build();
wtx.delete(LogicalDatastoreType.OPERATIONAL, iid);
wtx.submit();
for (NetworkElement ne : nullToEmpty(nes.getNetworkElement())) {
for (Interface iface : nullToEmpty(ne.getInterface())) {
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, ne.getIid(), iface.getIid());
+ processDeletedEN(en);
}
}
}
for (NetworkElement ne : nullToEmpty(nes.getNetworkElement())) {
for (Interface iface : nullToEmpty(ne.getInterface())) {
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, ne.getIid(), iface.getIid());
+ processDeletedEN(en);
}
}
}
NetworkElement ne = netElement.getDataBefore();
for (Interface iface : nullToEmpty(ne.getInterface())) {
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, ne.getIid(), iface.getIid());
+ processDeletedEN(en);
}
}
networkElements.getNetworkElement().remove(ne);
if (ne != null) {
for (Interface iface : nullToEmpty(ne.getInterface())) {
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, ne.getIid(), iface.getIid());
+ processDeletedEN(en);
}
}
networkElements.getNetworkElement().remove(ne);
case DELETE: {
Interface iface = modifiedInterface.getDataBefore();
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, nodeBefore.getIid(), iface.getIid());
+ processDeletedEN(en);
}
int nodeIndex = getIndexOf(nodeBefore);
networkElements.getNetworkElement().get(nodeIndex).getInterface().remove(iface);
int nodeIndex = getIndexOf(nodeBefore);
if (iface != null) {
for (EndpointNetwork en : nullToEmpty(iface.getEndpointNetwork())) {
- processDeletedEN(en, nodeBefore.getIid(), iface.getIid());
+ processDeletedEN(en);
}
networkElements.getNetworkElement().get(nodeIndex).getInterface().remove(iface);
}
NetworkElement nodeBefore, Interface ifaceBefore) {
switch (modifiedEN.getModificationType()) {
case DELETE: {
- processDeletedEN(modifiedEN.getDataBefore(), nodeBefore.getIid(), ifaceBefore.getIid());
+ processDeletedEN(modifiedEN.getDataBefore());
int nodeIndex = getIndexOf(nodeBefore);
int ifaceIndex = getIndexOf(ifaceBefore, nodeIndex);
networkElements.getNetworkElement()
&& endpoint.getContextId().equals(en.getL3ContextId())
&& endpoint.getAddressType().isAssignableFrom(IpPrefixType.class)
&& NetUtils.samePrefix(new IpPrefix(endpoint.getAddress().toCharArray()), en.getIpPrefix())) {
- InstanceIdentifier<RealLocation> iid = IidFactory
+ InstanceIdentifier<AbsoluteLocation> iid = IidFactory
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
- .child(RealLocation.class)
+ .child(AbsoluteLocation.class)
.build();
wtx.put(LogicalDatastoreType.OPERATIONAL, iid, createRealLocation(nodeIID, connectorIID), true);
wtx.submit();
}
}
- private void processDeletedEN(EndpointNetwork en, InstanceIdentifier<?> nodeIID,
- InstanceIdentifier<?> connectorIID) {
+ private void processDeletedEN(EndpointNetwork en) {
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
for (AddressEndpoint endpoint : endpoints) {
if (endpoint.getContextType().isAssignableFrom(L3Context.class)
&& endpoint.getContextId().equals(en.getL3ContextId())
&& endpoint.getAddressType().isAssignableFrom(IpPrefixType.class)
&& NetUtils.samePrefix(new IpPrefix(endpoint.getAddress().toCharArray()), en.getIpPrefix())) {
- InstanceIdentifier<RealLocation> iid = IidFactory
+ InstanceIdentifier<AbsoluteLocation> iid = IidFactory
.providerAddressEndpointLocationIid(NE_LOCATION_PROVIDER_NAME, IpPrefixType.class,
endpoint.getAddress(), endpoint.getContextType(), endpoint.getContextId())
- .child(RealLocation.class)
+ .child(AbsoluteLocation.class)
.build();
wtx.delete(LogicalDatastoreType.OPERATIONAL, iid);
wtx.submit();
}
}
- private RealLocation createRealLocation(InstanceIdentifier<?> node, InstanceIdentifier<?> iface) {
- return new RealLocationBuilder()
- .setLocationType(new RegularLocationCaseBuilder().setNode(node).setNodeConnector(iface).build()).build();
+ private AbsoluteLocation createRealLocation(InstanceIdentifier<?> node, InstanceIdentifier<?> iface) {
+ return new AbsoluteLocationBuilder()
+ .setLocationType(new InternalLocationCaseBuilder().setInternalNode(node).setInternalNodeConnector(iface).build()).build();
}
private <T> List<T> nullToEmpty(@Nullable List<T> list) {