ONOS-5595 netcfg for protection
- ProtectionConfig
- TransportEndpointDescriptionCodec
Change-Id: I79e304a20e9d1f95a4b432542738c64102550650
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/protection/ProtectionConfig.java b/core/api/src/main/java/org/onosproject/net/behaviour/protection/ProtectionConfig.java
new file mode 100644
index 0000000..94ed965
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/protection/ProtectionConfig.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour.protection;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.BaseConfig;
+
+// FIXME Move this to Protection handling Intent related package?
+/**
+ * Config object for protection end-point.
+ * <p>
+ * Contains equivalent of {@link ProtectedTransportEndpointDescription}.
+ */
+public class ProtectionConfig
+ extends BaseConfig<DeviceId> {
+
+ /**
+ * {@value #CONFIG_KEY} : a netcfg ConfigKey for {@link ProtectionConfig}.
+ */
+ public static final String CONFIG_KEY = "protection";
+
+ /**
+ * JSON key for paths.
+ * <p>
+ * Value is list of {@link TransportEndpointDescription} in JSON.
+ */
+ private static final String PATHS = "paths";
+ /**
+ * JSON key for Peer {@link DeviceId}.
+ */
+ private static final String PEER = "peer";
+ private static final String FINGERPRINT = "fingerprint";
+
+
+ @Override
+ public boolean isValid() {
+ return isString(PEER, FieldPresence.MANDATORY) &&
+ isString(FINGERPRINT, FieldPresence.MANDATORY) &&
+ hasField(PATHS);
+ }
+
+
+ /**
+ * Returns List of underlying transport entity endpoints in priority order.
+ *
+ * @return the transport entity endpoint descriptions
+ */
+ public List<TransportEndpointDescription> paths() {
+ return getList(PATHS,
+ jsonStr -> decode(jsonStr, TransportEndpointDescription.class));
+ }
+
+ /**
+ * Sets the List of underlying transport entity endpoints in priority order.
+ *
+ * @param paths the transport entity endpoint descriptions
+ * @return self
+ */
+ public ProtectionConfig paths(List<TransportEndpointDescription> paths) {
+ setList(PATHS,
+ elm -> encode(elm, TransportEndpointDescription.class).toString(),
+ paths);
+ return this;
+ }
+
+ /**
+ * Returns DeviceId of remote peer of this endpoint.
+ *
+ * @return the peer
+ */
+ public DeviceId peer() {
+ return DeviceId.deviceId(get(PEER, ""));
+ }
+
+ /**
+ * Sets the DeviceId of remote peer of this endpoint.
+ *
+ * @param peer DeviceId
+ * @return self
+ */
+ public ProtectionConfig peer(DeviceId peer) {
+ setOrClear(PEER, peer.toString());
+ return this;
+ }
+
+ /**
+ * Returns fingerprint to identify this protected transport entity.
+ *
+ * @return the fingerprint
+ */
+ public String fingerprint() {
+ return get(FINGERPRINT, "");
+ }
+
+ /**
+ * Sets the fingerprint to identify this protected transport entity.
+ *
+ * @param fingerprint the fingerprint
+ * @return self
+ */
+ public ProtectionConfig fingerprint(String fingerprint) {
+ setOrClear(FINGERPRINT, checkNotNull(fingerprint));
+ return this;
+ }
+
+ /**
+ * Returns equivalent of this Config as {@link ProtectedTransportEndpointDescription}.
+ *
+ * @return {@link ProtectedTransportEndpointDescription}
+ */
+ public ProtectedTransportEndpointDescription asDescription() {
+ return ProtectedTransportEndpointDescription.of(paths(), peer(), fingerprint());
+ }
+
+ @Override
+ public String toString() {
+ return object.toString();
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/config/BaseConfig.java b/core/api/src/main/java/org/onosproject/net/config/BaseConfig.java
index 33d485f..5f87ed1 100644
--- a/core/api/src/main/java/org/onosproject/net/config/BaseConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/config/BaseConfig.java
@@ -37,8 +37,7 @@
extends Config<S>
implements CodecContext {
- // might need to make it non-final for unit testing
- private static final ServiceDirectory SERVICES = new DefaultServiceDirectory();
+ private static ServiceDirectory services = new DefaultServiceDirectory();
private static final Logger log = getLogger(BaseConfig.class);
@Override
@@ -48,7 +47,7 @@
@Override
public <T> T getService(Class<T> serviceClass) {
- return SERVICES.get(serviceClass);
+ return services.get(serviceClass);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/config/Config.java b/core/api/src/main/java/org/onosproject/net/config/Config.java
index a3824c8..9cea1b9 100644
--- a/core/api/src/main/java/org/onosproject/net/config/Config.java
+++ b/core/api/src/main/java/org/onosproject/net/config/Config.java
@@ -33,6 +33,7 @@
import java.util.List;
import java.util.Set;
import java.util.function.Function;
+import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
@@ -358,11 +359,28 @@
protected <T> List<T> getList(String name, Function<String, T> function) {
List<T> list = Lists.newArrayList();
ArrayNode arrayNode = (ArrayNode) object.path(name);
- arrayNode.forEach(i -> list.add(function.apply(i.asText())));
+ arrayNode.forEach(i -> list.add(function.apply(asString(i))));
return list;
}
/**
+ * Converts JSON node to a String.
+ * <p>
+ * If the {@code node} was a text node, text is returned as-is,
+ * all other node type will be converted to String by toString().
+ *
+ * @param node JSON node to convert
+ * @return String representation
+ */
+ private static String asString(JsonNode node) {
+ if (node.isTextual()) {
+ return node.asText();
+ } else {
+ return node.toString();
+ }
+ }
+
+ /**
* Gets the specified array property as a list of items.
*
* @param name property name
@@ -378,11 +396,30 @@
return defaultValue;
}
ArrayNode arrayNode = (ArrayNode) jsonNode;
- arrayNode.forEach(i -> list.add(function.apply(i.asText())));
+ arrayNode.forEach(i -> list.add(function.apply(asString(i))));
return list;
}
/**
+ * Sets the specified property as an array of items in a given collection
+ * transformed into a String with supplied {@code function}.
+ *
+ * @param name propertyName
+ * @param function to transform item to a String
+ * @param value list of items
+ * @param <T> type of items
+ * @return self
+ */
+ protected <T> Config<S> setList(String name,
+ Function<? super T, String> function,
+ List<T> value) {
+ Collection<String> mapped = value.stream()
+ .map(function)
+ .collect(Collectors.toList());
+ return setOrClear(name, mapped);
+ }
+
+ /**
* Sets the specified property as an array of items in a given collection or
* clears it if null is given.
*
diff --git a/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java
new file mode 100644
index 0000000..518db0b
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.intent;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Collection;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.NetworkResource;
+import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Installable Intent for the ProtectionEndpoint (head/tail).
+ */
+@Immutable
+@Beta
+public class ProtectionEndpointIntent extends Intent {
+
+ private final DeviceId deviceId;
+ private final ProtectedTransportEndpointDescription description;
+
+
+ protected ProtectionEndpointIntent(ApplicationId appId, Key key,
+ Collection<NetworkResource> resources,
+ int priority,
+ DeviceId deviceId,
+ ProtectedTransportEndpointDescription description) {
+ super(appId, key, resources, priority);
+
+ this.deviceId = checkNotNull(deviceId);
+ this.description = checkNotNull(description);
+ }
+
+ /**
+ * Returns the identifier of the device to be configured.
+ *
+ * @return the deviceId
+ */
+ public DeviceId deviceId() {
+ return deviceId;
+ }
+
+ /**
+ * Returns the description of this protection endpoint.
+ *
+ * @return the description
+ */
+ public ProtectedTransportEndpointDescription description() {
+ return description;
+ }
+
+ @Override
+ public boolean isInstallable() {
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("id", id())
+ .add("key", key())
+ .add("appId", appId())
+ .add("priority", priority())
+ .add("resources", resources())
+ .add("deviceId", deviceId)
+ .add("description", description)
+ .toString();
+ }
+
+ /**
+ * Returns a new {@link ProtectionEndpointIntent} builder.
+ *
+ * @return the builder
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder for {@link ProtectionEndpointIntent}.
+ */
+ public static class Builder extends Intent.Builder {
+
+ private DeviceId deviceId;
+ private ProtectedTransportEndpointDescription description;
+
+ /**
+ * Creates a new empty builder.
+ */
+ protected Builder() {
+ resources = ImmutableList.of();
+ }
+
+ /**
+ * Creates a new builder pre-populated with the information in the given
+ * intent.
+ *
+ * @param intent initial intent
+ */
+ protected Builder(ProtectionEndpointIntent intent) {
+ super(intent);
+ }
+
+ // TODO remove these overrides
+ @Override
+ public Builder key(Key key) {
+ super.key(key);
+ return this;
+ }
+
+ @Override
+ public Builder appId(ApplicationId appId) {
+ super.appId(appId);
+ return this;
+ }
+
+ @Override
+ public Builder resources(Collection<NetworkResource> resources) {
+ super.resources(resources);
+ return this;
+ }
+
+ @Override
+ public Builder priority(int priority) {
+ super.priority(priority);
+ return this;
+ }
+
+ public Builder deviceId(DeviceId deviceId) {
+ this.deviceId = deviceId;
+ return this;
+ }
+
+ public Builder description(ProtectedTransportEndpointDescription description) {
+ this.description = description;
+ return this;
+ }
+
+ public ProtectionEndpointIntent build() {
+ checkNotNull(key, "Key inherited from origin Intent expected.");
+ return new ProtectionEndpointIntent(appId,
+ key,
+ resources,
+ priority,
+ deviceId,
+ description);
+ }
+
+ }
+
+
+
+ /*
+ * For serialization.
+ */
+ @SuppressWarnings("unused")
+ private ProtectionEndpointIntent() {
+ this.deviceId = null;
+ this.description = null;
+ }
+}
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/CodecManager.java b/core/common/src/main/java/org/onosproject/codec/impl/CodecManager.java
index cd0e7ae..67066a0 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/CodecManager.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/CodecManager.java
@@ -56,6 +56,7 @@
import org.onosproject.net.DisjointPath;
import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.Port;
+import org.onosproject.net.behaviour.protection.TransportEndpointDescription;
import org.onosproject.net.device.PortStatistics;
import org.onosproject.net.driver.Driver;
import org.onosproject.net.flow.FlowEntry;
@@ -167,6 +168,7 @@
registerCodec(ProtocolStatInfo.class, new ProtocolStatInfoCodec());
registerCodec(FlowStatInfo.class, new FlowStatInfoCodec());
registerCodec(FilteredConnectPoint.class, new FilteredConnectPointCodec());
+ registerCodec(TransportEndpointDescription.class, new TransportEndpointDescriptionCodec());
log.info("Started");
}
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/TransportEndpointDescriptionCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/TransportEndpointDescriptionCodec.java
new file mode 100644
index 0000000..9019d66
--- /dev/null
+++ b/core/common/src/main/java/org/onosproject/codec/impl/TransportEndpointDescriptionCodec.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.codec.impl;
+
+import org.onosproject.codec.CodecContext;
+import org.onosproject.codec.JsonCodec;
+import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.behaviour.protection.TransportEndpointDescription;
+import org.onosproject.net.behaviour.protection.TransportEndpointDescription.Builder;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * JSON Codec for {@link TransportEndpointDescription}.
+ */
+public class TransportEndpointDescriptionCodec
+ extends JsonCodec<TransportEndpointDescription> {
+
+ private static final String OUTPUT = "output";
+ private static final String ENABLED = "enabled";
+
+ @Override
+ public TransportEndpointDescription decode(ObjectNode json,
+ CodecContext context) {
+
+ Builder builder = TransportEndpointDescription.builder();
+ builder.withEnabled(json.get(ENABLED).asBoolean(true));
+ builder.withOutput(context.decode(json.get(OUTPUT), FilteredConnectPoint.class));
+
+ return builder.build();
+ }
+
+ @Override
+ public ObjectNode encode(TransportEndpointDescription entity,
+ CodecContext context) {
+ ObjectNode node = context.mapper().createObjectNode();
+ node.put(ENABLED, entity.isEnabled());
+ node.set(OUTPUT, context.encode(entity.output(), FilteredConnectPoint.class));
+ return node;
+ }
+}
diff --git a/core/net/src/test/java/org/onosproject/net/behaviour/protection/ProtectionConfigTest.java b/core/net/src/test/java/org/onosproject/net/behaviour/protection/ProtectionConfigTest.java
new file mode 100644
index 0000000..946e86b
--- /dev/null
+++ b/core/net/src/test/java/org/onosproject/net/behaviour/protection/ProtectionConfigTest.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour.protection;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.*;
+import static org.onosproject.net.PortNumber.portNumber;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onlab.junit.TestUtils;
+import org.onlab.junit.TestUtils.TestUtilsException;
+import org.onlab.osgi.ServiceDirectory;
+import org.onlab.osgi.TestServiceDirectory;
+import org.onlab.packet.VlanId;
+import org.onosproject.codec.CodecService;
+import org.onosproject.codec.impl.CodecManager;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.config.BaseConfig;
+import org.onosproject.net.config.ConfigApplyDelegate;
+import org.onosproject.net.flow.DefaultTrafficSelector;
+import org.onosproject.net.flow.TrafficSelector;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.NumericNode;
+import com.google.common.collect.ImmutableList;
+
+public class ProtectionConfigTest {
+
+ private static TestServiceDirectory directory;
+ private static ServiceDirectory original;
+
+
+ // no-op
+ private ConfigApplyDelegate delegate = cfg -> { };
+
+
+ private final DeviceId did = DeviceId.deviceId("of:0000000000000001");
+ private final String fingerprint = "(IntentKey_XYZW)";
+ private final DeviceId peer = DeviceId.deviceId("of:0000000000000002");
+
+
+ private final ConnectPoint workingCp = new ConnectPoint(did, portNumber(1));
+ private final ConnectPoint backupCp = new ConnectPoint(did, portNumber(2));
+
+ private final TrafficSelector vlan100 = DefaultTrafficSelector.builder()
+ .matchVlanId(VlanId.vlanId((short) 100))
+ .build();
+
+
+ private final TransportEndpointDescription working
+ = TransportEndpointDescription.builder()
+ .withOutput(new FilteredConnectPoint(workingCp, vlan100))
+ .withEnabled(true)
+ .build();
+
+
+ private final TransportEndpointDescription backup
+ = TransportEndpointDescription.builder()
+ .withOutput(new FilteredConnectPoint(backupCp, vlan100))
+ .withEnabled(true)
+ .build();
+
+ private final List<TransportEndpointDescription> paths
+ = ImmutableList.of(working, backup);
+
+ private final ProtectedTransportEndpointDescription descr
+ = ProtectedTransportEndpointDescription.of(paths,
+ did,
+ fingerprint);
+
+
+ private ProtectionConfig sut;
+
+ private ObjectMapper mapper;
+
+ /**
+ * {@value #SAMPLE_JSON_PATH} after parsing.
+ */
+ private JsonNode node;
+
+ @BeforeClass
+ public static void setUpClass() throws TestUtilsException {
+ directory = new TestServiceDirectory();
+
+ CodecManager codecService = new CodecManager();
+ codecService.activate();
+ directory.add(CodecService.class, codecService);
+
+ // replace service directory used by BaseConfig
+ original = TestUtils.getField(BaseConfig.class, "services");
+ TestUtils.setField(BaseConfig.class, "services", directory);
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws TestUtilsException {
+ TestUtils.setField(BaseConfig.class, "services", original);
+ }
+
+ @Before
+ public void setUp() throws JsonProcessingException, IOException, TestUtilsException {
+
+ mapper = new ObjectMapper();
+ // Jackson configuration for ease of Numeric node comparison
+ // - treat integral number node as long node
+ mapper.enable(DeserializationFeature.USE_LONG_FOR_INTS);
+ mapper.setNodeFactory(new JsonNodeFactory(false) {
+ @Override
+ public NumericNode numberNode(int v) {
+ return super.numberNode((long) v);
+ }
+ @Override
+ public NumericNode numberNode(short v) {
+ return super.numberNode((long) v);
+ }
+ });
+
+ InputStream stream = ProtectionConfigTest.class
+ .getResourceAsStream("protection_config.json");
+ JsonNode tree = mapper.readTree(stream);
+
+ node = tree.path("devices")
+ .path(did.toString())
+ .path(ProtectionConfig.CONFIG_KEY);
+ assertTrue(node.isObject());
+
+ }
+
+ @Test
+ public void readTest() {
+ sut = new ProtectionConfig();
+ sut.init(did, ProtectionConfig.CONFIG_KEY, node, mapper, delegate);
+
+ assertThat(sut.subject(), is(did));
+ assertThat(sut.paths().size(), is(2));
+
+ TransportEndpointDescription readWorking = sut.paths().get(0);
+ assertThat(readWorking.isEnabled(), is(true));
+ assertThat(readWorking.output().connectPoint(), is(workingCp));
+ assertThat(readWorking.output().trafficSelector(), is(vlan100));
+
+ TransportEndpointDescription readBackup = sut.paths().get(1);
+ assertThat(readBackup.isEnabled(), is(true));
+ assertThat(readBackup.output().connectPoint(), is(backupCp));
+ assertThat(readBackup.output().trafficSelector(), is(vlan100));
+
+ assertThat(sut.fingerprint(), is(fingerprint));
+ assertThat(sut.peer(), is(peer));
+ }
+
+ @Test
+ public void writeTest() throws JsonProcessingException, IOException {
+ ProtectionConfig w = new ProtectionConfig();
+ w.init(did, ProtectionConfig.CONFIG_KEY, mapper.createObjectNode(), mapper, delegate);
+
+ // write fields
+ w.paths(paths);
+ w.fingerprint(fingerprint);
+ w.peer(peer);
+
+ // reparse JSON
+ JsonNode r = mapper.readTree(w.node().toString());
+
+ sut = new ProtectionConfig();
+ sut.init(did, ProtectionConfig.CONFIG_KEY, r, mapper, delegate);
+
+ // verify equivalence
+ assertThat(sut.paths().size(), is(2));
+
+ TransportEndpointDescription readWorking = sut.paths().get(0);
+ assertThat(readWorking.isEnabled(), is(true));
+ assertThat(readWorking.output().connectPoint(), is(workingCp));
+ assertThat(readWorking.output().trafficSelector(), is(vlan100));
+
+ TransportEndpointDescription readBackup = sut.paths().get(1);
+ assertThat(readBackup.isEnabled(), is(true));
+ assertThat(readBackup.output().connectPoint(), is(backupCp));
+ assertThat(readBackup.output().trafficSelector(), is(vlan100));
+
+
+ assertThat(sut.fingerprint(), is(fingerprint));
+ assertThat(sut.peer(), is(peer));
+ }
+}
diff --git a/core/net/src/test/resources/org/onosproject/net/behaviour/protection/protection_config.json b/core/net/src/test/resources/org/onosproject/net/behaviour/protection/protection_config.json
new file mode 100644
index 0000000..d75dfe7
--- /dev/null
+++ b/core/net/src/test/resources/org/onosproject/net/behaviour/protection/protection_config.json
@@ -0,0 +1,26 @@
+{
+ "devices" : {
+ "of:0000000000000001" : {
+ "protection" : {
+ "paths" : [
+ {
+ "output" : {
+ "connectPoint" : { "device" : "of:0000000000000001", "port" : "1" },
+ "trafficSelector" : { "criteria" : [ {"type" : "VLAN_VID", "vlanId" : 100 }]}
+ },
+ "enabled" : true
+ },
+ {
+ "output" : {
+ "connectPoint" : { "device" : "of:0000000000000001", "port" : "2" },
+ "trafficSelector" : { "criteria" : [ {"type" : "VLAN_VID", "vlanId" : 100 }]}
+ },
+ "enabled" : true
+ }
+ ],
+ "fingerprint" : "(IntentKey_XYZW)",
+ "peer" : "of:0000000000000002"
+ }
+ }
+ }
+}