Merge remote-tracking branch 'origin/master' into dev/murrelet
diff --git a/apps/configsync-netconf/pom.xml b/apps/configsync-netconf/pom.xml
index 068d732..98e3868 100644
--- a/apps/configsync-netconf/pom.xml
+++ b/apps/configsync-netconf/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${onos.version}</version>
</dependency>
diff --git a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
index e5c9973..99b8afb 100644
--- a/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
+++ b/apps/dhcprelay/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
@@ -90,6 +90,8 @@
public static final ProviderId PROVIDER_ID = new ProviderId("host", DHCP_RELAY_APP);
public static final String HOST_LOCATION_PROVIDER =
"org.onosproject.provider.host.impl.HostLocationProvider";
+ public static final String ROUTE_STORE_IMPL =
+ "org.onosproject.routeservice.store.RouteStoreImpl";
private final Logger log = LoggerFactory.getLogger(getClass());
private final InternalConfigListener cfgListener = new InternalConfigListener();
@@ -170,6 +172,9 @@
// disable dhcp from host location provider
compCfgService.preSetProperty(HOST_LOCATION_PROVIDER,
"useDhcp", Boolean.FALSE.toString());
+ // Enable distribute route store
+ compCfgService.preSetProperty(ROUTE_STORE_IMPL,
+ "distributed", Boolean.TRUE.toString());
compCfgService.registerProperties(getClass());
log.info("DHCP-RELAY Started");
}
diff --git a/apps/netconf/client/pom.xml b/apps/netconf/client/pom.xml
index 37f94ce..50de210 100644
--- a/apps/netconf/client/pom.xml
+++ b/apps/netconf/client/pom.xml
@@ -64,7 +64,7 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${onos.version}</version>
</dependency>
diff --git a/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfTranslatorImpl.java b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfTranslatorImpl.java
index fa262cc..b2c2161 100644
--- a/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfTranslatorImpl.java
+++ b/apps/netconf/client/src/main/java/org/onosproject/netconf/client/impl/NetconfTranslatorImpl.java
@@ -69,7 +69,7 @@
import java.util.regex.Pattern;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
import static org.onosproject.yang.model.DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE;
import static org.onosproject.yang.runtime.SerializerHelper.addDataNode;
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
index 9f91712..bbbbc3c 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java
@@ -253,7 +253,7 @@
}
// Process the ingress device
- addFilterToDevice(source.deviceId(), source.port(), assignedVlan(source));
+ addFilterToDevice(source.deviceId(), source.port(), assignedVlan(source), mcastIp);
// When source and sink are on the same device
if (source.deviceId().equals(sink.deviceId())) {
@@ -277,7 +277,7 @@
links.forEach(link -> {
addPortToDevice(link.src().deviceId(), link.src().port(), mcastIp,
assignedVlan(link.src().deviceId().equals(source.deviceId()) ? source : null));
- addFilterToDevice(link.dst().deviceId(), link.dst().port(), assignedVlan(null));
+ addFilterToDevice(link.dst().deviceId(), link.dst().port(), assignedVlan(null), mcastIp);
});
// Process the egress device
@@ -344,7 +344,7 @@
links.forEach(link -> {
addPortToDevice(link.src().deviceId(), link.src().port(), mcastIp,
assignedVlan(link.src().deviceId().equals(source.deviceId()) ? source : null));
- addFilterToDevice(link.dst().deviceId(), link.dst().port(), assignedVlan(null));
+ addFilterToDevice(link.dst().deviceId(), link.dst().port(), assignedVlan(null), mcastIp);
});
// Setup new transit mcast role
mcastRoleStore.put(new McastStoreKey(mcastIp,
@@ -365,7 +365,7 @@
* @param port ingress port number
* @param assignedVlan assigned VLAN ID
*/
- private void addFilterToDevice(DeviceId deviceId, PortNumber port, VlanId assignedVlan) {
+ private void addFilterToDevice(DeviceId deviceId, PortNumber port, VlanId assignedVlan, IpAddress mcastIp) {
// Do nothing if the port is configured as suppressed
ConnectPoint connectPoint = new ConnectPoint(deviceId, port);
SegmentRoutingAppConfig appConfig = srManager.cfgService
@@ -376,7 +376,7 @@
}
FilteringObjective.Builder filtObjBuilder =
- filterObjBuilder(deviceId, port, assignedVlan);
+ filterObjBuilder(deviceId, port, assignedVlan, mcastIp);
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug("Successfully add filter on {}/{}, vlan {}",
deviceId, port.toLong(), assignedVlan),
@@ -596,9 +596,17 @@
private ForwardingObjective.Builder fwdObjBuilder(IpAddress mcastIp,
VlanId assignedVlan, int nextId) {
TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder();
- IpPrefix mcastPrefix = IpPrefix.valueOf(mcastIp, IpPrefix.MAX_INET_MASK_LENGTH);
- sbuilder.matchEthType(Ethernet.TYPE_IPV4);
- sbuilder.matchIPDst(mcastPrefix);
+ IpPrefix mcastPrefix = mcastIp.toIpPrefix();
+
+ if (mcastIp.isIp4()) {
+ sbuilder.matchEthType(Ethernet.TYPE_IPV4);
+ sbuilder.matchIPDst(mcastPrefix);
+ } else {
+ sbuilder.matchEthType(Ethernet.TYPE_IPV6);
+ sbuilder.matchIPv6Dst(mcastPrefix);
+ }
+
+
TrafficSelector.Builder metabuilder = DefaultTrafficSelector.builder();
metabuilder.matchVlanId(assignedVlan);
@@ -621,14 +629,22 @@
* @return filtering objective builder
*/
private FilteringObjective.Builder filterObjBuilder(DeviceId deviceId, PortNumber ingressPort,
- VlanId assignedVlan) {
+ VlanId assignedVlan, IpAddress mcastIp) {
FilteringObjective.Builder filtBuilder = DefaultFilteringObjective.builder();
- filtBuilder.withKey(Criteria.matchInPort(ingressPort))
- .addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
- MacAddress.IPV4_MULTICAST_MASK))
- .addCondition(Criteria.matchVlanId(egressVlan()))
- .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+ if (mcastIp.isIp4()) {
+ filtBuilder.withKey(Criteria.matchInPort(ingressPort))
+ .addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
+ MacAddress.IPV4_MULTICAST_MASK))
+ .addCondition(Criteria.matchVlanId(egressVlan()))
+ .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+ } else {
+ filtBuilder.withKey(Criteria.matchInPort(ingressPort))
+ .addCondition(Criteria.matchEthDstMasked(MacAddress.IPV6_MULTICAST,
+ MacAddress.IPV6_MULTICAST_MASK))
+ .addCondition(Criteria.matchVlanId(egressVlan()))
+ .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+ }
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
filtBuilder.withMeta(tt);
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 477b466..49e2969 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -21,7 +21,6 @@
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-
import org.onlab.packet.ChassisId;
import org.onlab.packet.EthType;
import org.onlab.packet.Ip4Address;
@@ -139,6 +138,7 @@
import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
import org.onosproject.net.flow.criteria.OduSignalIdCriterion;
import org.onosproject.net.flow.criteria.OduSignalTypeCriterion;
+import org.onosproject.net.flow.criteria.PiCriterion;
import org.onosproject.net.flow.criteria.PortCriterion;
import org.onosproject.net.flow.criteria.SctpPortCriterion;
import org.onosproject.net.flow.criteria.TcpPortCriterion;
@@ -153,6 +153,7 @@
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
import org.onosproject.net.flow.instructions.L3ModificationInstruction;
import org.onosproject.net.flow.instructions.L4ModificationInstruction;
+import org.onosproject.net.flow.instructions.PiInstruction;
import org.onosproject.net.flowobjective.DefaultFilteringObjective;
import org.onosproject.net.flowobjective.DefaultForwardingObjective;
import org.onosproject.net.flowobjective.DefaultNextObjective;
@@ -198,7 +199,31 @@
import org.onosproject.net.packet.DefaultOutboundPacket;
import org.onosproject.net.packet.DefaultPacketRequest;
import org.onosproject.net.packet.PacketPriority;
+import org.onosproject.net.pi.model.PiMatchType;
+import org.onosproject.net.pi.model.PiPipeconfId;
+import org.onosproject.net.pi.runtime.PiAction;
+import org.onosproject.net.pi.runtime.PiActionGroup;
+import org.onosproject.net.pi.runtime.PiActionGroupId;
+import org.onosproject.net.pi.runtime.PiActionGroupMember;
+import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
+import org.onosproject.net.pi.runtime.PiActionId;
+import org.onosproject.net.pi.runtime.PiActionParam;
+import org.onosproject.net.pi.runtime.PiActionParamId;
+import org.onosproject.net.pi.runtime.PiExactFieldMatch;
+import org.onosproject.net.pi.runtime.PiFieldMatch;
+import org.onosproject.net.pi.runtime.PiHeaderFieldId;
+import org.onosproject.net.pi.runtime.PiLpmFieldMatch;
+import org.onosproject.net.pi.runtime.PiMatchKey;
+import org.onosproject.net.pi.runtime.PiPacketMetadata;
+import org.onosproject.net.pi.runtime.PiPacketMetadataId;
+import org.onosproject.net.pi.runtime.PiPacketOperation;
+import org.onosproject.net.pi.runtime.PiPipeconfConfig;
+import org.onosproject.net.pi.runtime.PiRangeFieldMatch;
+import org.onosproject.net.pi.runtime.PiTableAction;
+import org.onosproject.net.pi.runtime.PiTableEntry;
import org.onosproject.net.pi.runtime.PiTableId;
+import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
+import org.onosproject.net.pi.runtime.PiValidFieldMatch;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.net.region.DefaultRegion;
import org.onosproject.net.region.Region;
@@ -215,10 +240,10 @@
import org.onosproject.store.primitives.MapUpdate;
import org.onosproject.store.primitives.TransactionId;
import org.onosproject.store.service.MapEvent;
-import org.onosproject.store.service.TransactionLog;
import org.onosproject.store.service.MultimapEvent;
import org.onosproject.store.service.SetEvent;
import org.onosproject.store.service.Task;
+import org.onosproject.store.service.TransactionLog;
import org.onosproject.store.service.Versioned;
import org.onosproject.store.service.WorkQueueStats;
import org.onosproject.ui.model.topo.UiTopoLayoutId;
@@ -565,6 +590,38 @@
.register(MarkerResource.class)
.register(new BitSetSerializer(), BitSet.class)
.register(DomainIntent.class)
+ .register(
+ // PI model
+ PiMatchType.class,
+ PiPipeconfId.class,
+ // PI Runtime
+ PiAction.class,
+ PiActionGroup.class,
+ PiActionGroupId.class,
+ PiActionGroupMember.class,
+ PiActionGroupMemberId.class,
+ PiActionId.class,
+ PiActionParam.class,
+ PiActionParamId.class,
+ PiExactFieldMatch.class,
+ PiFieldMatch.class,
+ PiHeaderFieldId.class,
+ PiLpmFieldMatch.class,
+ PiMatchKey.class,
+ PiPacketMetadata.class,
+ PiPacketMetadataId.class,
+ PiPacketOperation.class,
+ PiPipeconfConfig.class,
+ PiRangeFieldMatch.class,
+ PiTableAction.class,
+ PiTableEntry.class,
+ PiTableId.class,
+ PiTernaryFieldMatch.class,
+ PiValidFieldMatch.class,
+ // Other
+ PiCriterion.class,
+ PiInstruction.class
+ )
.build("API");
/**
diff --git a/drivers/bmv2/BUCK b/drivers/bmv2/BUCK
index b13a673..d9b09bb 100644
--- a/drivers/bmv2/BUCK
+++ b/drivers/bmv2/BUCK
@@ -14,7 +14,6 @@
BUNDLES = [
':onos-drivers-bmv2',
'//incubator/bmv2/model:onos-incubator-bmv2-model',
- '//drivers/default:onos-drivers-default',
]
osgi_jar(
@@ -29,9 +28,6 @@
description = 'Adds support for BMv2 P4 devices.',
included_bundles = BUNDLES,
required_apps = [
- 'org.onosproject.generaldeviceprovider',
- 'org.onosproject.protocols.p4runtime',
- 'org.onosproject.p4runtime',
- 'org.onosproject.drivers.p4runtime'
+ 'org.onosproject.drivers.p4runtime',
],
-)
+)
\ No newline at end of file
diff --git a/drivers/cisco/netconf/features.xml b/drivers/cisco/netconf/features.xml
index 49f4884..9d4a490 100644
--- a/drivers/cisco/netconf/features.xml
+++ b/drivers/cisco/netconf/features.xml
@@ -23,6 +23,6 @@
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-drivers-utilities/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</bundle>
</feature>
</features>
diff --git a/drivers/cisco/netconf/pom.xml b/drivers/cisco/netconf/pom.xml
index dbddedd..622e4a7 100644
--- a/drivers/cisco/netconf/pom.xml
+++ b/drivers/cisco/netconf/pom.xml
@@ -49,7 +49,7 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java
index 95dcfa1..9f2e84c 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java
@@ -18,6 +18,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.onlab.packet.Ethernet;
+import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
@@ -491,10 +492,30 @@
+ " in dev:{}", fwd.id(), fwd.nextId(), deviceId);
}
} else if (ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
- if (buildIpv6Selector(filteredSelector, fwd) < 0) {
- return Collections.emptyList();
+ IpPrefix ipv6Dst = ((IPCriterion) selector.getCriterion(Criterion.Type.IPV6_DST)).ip();
+ if (ipv6Dst.isMulticast()) {
+ if (ipv6Dst.prefixLength() != IpAddress.INET6_BIT_LENGTH) {
+ log.debug("Multicast specific IPv6 forwarding objective can only be /128");
+ fail(fwd, ObjectiveError.BADPARAMS);
+ return ImmutableSet.of();
+ }
+ VlanId assignedVlan = readVlanFromSelector(fwd.meta());
+ if (assignedVlan == null) {
+ log.debug("VLAN ID required by multicast specific fwd obj is missing. Abort.");
+ fail(fwd, ObjectiveError.BADPARAMS);
+ return ImmutableSet.of();
+ }
+ filteredSelector.matchVlanId(assignedVlan);
+ filteredSelector.matchEthType(Ethernet.TYPE_IPV6).matchIPv6Dst(ipv6Dst);
+ forTableId = MULTICAST_ROUTING_TABLE;
+ log.debug("processing IPv6 multicast specific forwarding objective {} -> next:{}"
+ + " in dev:{}", fwd.id(), fwd.nextId(), deviceId);
+ } else {
+ if (buildIpv6Selector(filteredSelector, fwd) < 0) {
+ return Collections.emptyList();
+ }
+ forTableId = UNICAST_ROUTING_TABLE;
}
- forTableId = UNICAST_ROUTING_TABLE;
} else {
filteredSelector
.matchEthType(Ethernet.MPLS_UNICAST)
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
index cc85cbf..c0c6639 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java
@@ -19,6 +19,7 @@
import com.google.common.collect.Sets;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.Ethernet;
+import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.VlanId;
import org.onlab.util.KryoNamespace;
@@ -857,6 +858,7 @@
protected List<FlowRule> processMcastEthDstFilter(EthCriterion ethCriterion,
ApplicationId applicationId) {
+ ImmutableList.Builder<FlowRule> builder = ImmutableList.builder();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
selector.matchEthType(Ethernet.TYPE_IPV4);
@@ -870,7 +872,22 @@
.fromApp(applicationId)
.makePermanent()
.forTable(TMAC_TABLE).build();
- return ImmutableList.<FlowRule>builder().add(rule).build();
+ builder.add(rule);
+
+ selector = DefaultTrafficSelector.builder();
+ treatment = DefaultTrafficTreatment.builder();
+ selector.matchEthType(Ethernet.TYPE_IPV6);
+ selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask());
+ treatment.transition(MULTICAST_ROUTING_TABLE);
+ rule = DefaultFlowRule.builder()
+ .forDevice(deviceId)
+ .withSelector(selector.build())
+ .withTreatment(treatment.build())
+ .withPriority(DEFAULT_PRIORITY)
+ .fromApp(applicationId)
+ .makePermanent()
+ .forTable(TMAC_TABLE).build();
+ return builder.add(rule).build();
}
private Collection<FlowRule> processForward(ForwardingObjective fwd) {
@@ -1281,16 +1298,34 @@
IpPrefix ipv6Dst = ((IPCriterion) selector.getCriterion(Criterion.Type.IPV6_DST)).ip();
if (ipv6Dst.isMulticast()) {
- log.warn("IPv6 Multicast is currently not supported");
- fail(fwd, ObjectiveError.BADPARAMS);
- return -1;
- }
- if (ipv6Dst.prefixLength() != 0) {
- builderToUpdate.matchIPv6Dst(ipv6Dst);
- }
+ if (ipv6Dst.prefixLength() != IpAddress.INET6_BIT_LENGTH) {
+ log.warn("Multicast specific forwarding objective can only be /128");
+ fail(fwd, ObjectiveError.BADPARAMS);
+ return -1;
+ }
+ VlanId assignedVlan = readVlanFromSelector(fwd.meta());
+ if (assignedVlan == null) {
+ log.warn("VLAN ID required by multicast specific fwd obj is missing. Abort.");
+ fail(fwd, ObjectiveError.BADPARAMS);
+ return -1;
+ }
+ if (requireVlanExtensions()) {
+ OfdpaMatchVlanVid ofdpaMatchVlanVid = new OfdpaMatchVlanVid(assignedVlan);
+ builderToUpdate.extension(ofdpaMatchVlanVid, deviceId);
+ } else {
+ builderToUpdate.matchVlanId(assignedVlan);
+ }
+ builderToUpdate.matchEthType(Ethernet.TYPE_IPV6).matchIPv6Dst(ipv6Dst);
+ log.debug("processing IPv6 multicast specific forwarding objective {} -> next:{}"
+ + " in dev:{}", fwd.id(), fwd.nextId(), deviceId);
+ } else {
+ if (ipv6Dst.prefixLength() != 0) {
+ builderToUpdate.matchIPv6Dst(ipv6Dst);
+ }
builderToUpdate.matchEthType(Ethernet.TYPE_IPV6);
log.debug("processing IPv6 unicast specific forwarding objective {} -> next:{}"
+ " in dev:{}", fwd.id(), fwd.nextId(), deviceId);
+ }
return 0;
}
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3QmxPipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3QmxPipeline.java
index cc7c23d..4c6664b 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3QmxPipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa3QmxPipeline.java
@@ -18,19 +18,8 @@
import static org.slf4j.LoggerFactory.getLogger;
-import java.util.Collection;
-import org.onlab.packet.Ethernet;
-import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.criteria.Criterion;
-import org.onosproject.net.flow.criteria.EthTypeCriterion;
-import org.onosproject.net.flow.criteria.IPCriterion;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ObjectiveError;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableSet;
-
/**
* Pipeliner for Broadcom OF-DPA 3.0 TTP, specifically for Qumran based switches.
*/
@@ -47,50 +36,4 @@
protected boolean matchInPortTmacTable() {
return false;
}
-
- @Override
- protected Collection<FlowRule> processEthTypeSpecific(ForwardingObjective fwd) {
- TrafficSelector selector = fwd.selector();
- EthTypeCriterion ethType =
- (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
- //XXX remove when support is added to Qumran based OF-DPA
- if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4 ||
- ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
- log.warn("Routing table is currently unsupported in dev:{}", deviceId);
- return ImmutableSet.of();
- }
-
- return super.processEthTypeSpecific(fwd);
- }
-
- @Override
- protected Collection<FlowRule> processVersatile(ForwardingObjective fwd) {
- EthTypeCriterion ethType =
- (EthTypeCriterion) fwd.selector().getCriterion(Criterion.Type.ETH_TYPE);
- if (ethType == null) {
- log.error("Versatile forwarding objective:{} must include ethType",
- fwd.id());
- fail(fwd, ObjectiveError.BADPARAMS);
- return ImmutableSet.of();
- }
- //XXX remove when support is added to Qumran based OF-DPA
- if (ethType.ethType().toShort() == Ethernet.TYPE_IPV6) {
- log.warn("ACL table for IPv6 is currently unsupported in dev:{}", deviceId);
- return ImmutableSet.of();
- }
-
- if (ethType.ethType().toShort() == Ethernet.TYPE_IPV4) {
- for (Criterion c : fwd.selector().criteria()) {
- if (c instanceof IPCriterion) {
- if (((IPCriterion) c).type() == Criterion.Type.IPV4_DST) {
- log.warn("ACL table for Dst IPv4 is currently "
- + "unsupported in dev:{}", deviceId);
- return ImmutableSet.of();
- }
- }
- }
- }
-
- return super.processVersatile(fwd);
- }
}
diff --git a/drivers/default/src/main/resources/onos-drivers.xml b/drivers/default/src/main/resources/onos-drivers.xml
index 4fce46f..3d5f6d0 100644
--- a/drivers/default/src/main/resources/onos-drivers.xml
+++ b/drivers/default/src/main/resources/onos-drivers.xml
@@ -105,7 +105,7 @@
</driver>
<driver name="accton-ofdpa3" extends="ofdpa3"
- manufacturer="Accton Corp\." hwVersion=".*" swVersion="ofdpa 3.*">
+ manufacturer="Accton Corp\." hwVersion=".*" swVersion="ofdpa .*">
</driver>
<driver name="znyx-ofdpa" extends="ofdpa3"
diff --git a/drivers/fujitsu/features.xml b/drivers/fujitsu/features.xml
index 66b0bce..5f2b7c4 100644
--- a/drivers/fujitsu/features.xml
+++ b/drivers/fujitsu/features.xml
@@ -23,6 +23,6 @@
<bundle>mvn:${project.groupId}/onos-drivers-utilities/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</bundle>
</feature>
</features>
diff --git a/drivers/fujitsu/pom.xml b/drivers/fujitsu/pom.xml
index 9a3d81a..32d766f 100644
--- a/drivers/fujitsu/pom.xml
+++ b/drivers/fujitsu/pom.xml
@@ -51,12 +51,12 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-ctl</artifactId>
+ <artifactId>onos-protocols-netconf-ctl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -77,7 +77,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.4</version>
</dependency>
</dependencies>
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
index bbb373d..860d6e1 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfig.java
@@ -31,7 +31,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtility.*;
import static org.slf4j.LoggerFactory.getLogger;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
/**
* Implementation to get and set parameters available in vOLT
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
index 4fd8ed1..c304609 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfig.java
@@ -31,7 +31,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtility.*;
import static org.slf4j.LoggerFactory.getLogger;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
/**
* Implementation to get and set parameters available in vOLT
diff --git a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
index 4908127..bbf405c 100644
--- a/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
+++ b/drivers/fujitsu/src/main/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfig.java
@@ -35,7 +35,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtility.*;
import static org.slf4j.LoggerFactory.getLogger;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
/**
* Implementation to get and set parameters available in vOLT
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfControllerMock.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfControllerMock.java
index e9b3af4..8659246 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfControllerMock.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfControllerMock.java
@@ -24,7 +24,7 @@
import org.onosproject.netconf.NetconfDevice;
import org.onosproject.netconf.NetconfDeviceInfo;
import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.ctl.NetconfControllerImpl;
+import org.onosproject.netconf.ctl.impl.NetconfControllerImpl;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionListenerTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionListenerTest.java
index a5b1433..f1930bc 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionListenerTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionListenerTest.java
@@ -17,7 +17,7 @@
package org.onosproject.drivers.fujitsu;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.DatastoreId;
public interface FujitsuNetconfSessionListenerTest {
@@ -50,7 +50,7 @@
* @param newConfiguration configuration to set
* @return true if everuthing as expected
*/
- boolean verifyEditConfig(TargetConfig targetConfiguration, String mode, String newConfiguration);
+ boolean verifyEditConfig(DatastoreId targetConfiguration, String mode, String newConfiguration);
/**
* Verify get request arguments.
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionMock.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionMock.java
index 745c095..132b11d 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionMock.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuNetconfSessionMock.java
@@ -17,19 +17,19 @@
package org.onosproject.drivers.fujitsu;
import com.google.common.annotations.Beta;
-import org.onosproject.netconf.TargetConfig;
+
+import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfDeviceOutputEventListener;
import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.NetconfSession;
+import org.onosproject.netconf.NetconfSessionAdapter;
-import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
* Mock NetconfSessionImpl.
*/
-public class FujitsuNetconfSessionMock implements NetconfSession {
+public class FujitsuNetconfSessionMock extends NetconfSessionAdapter {
private FujitsuNetconfSessionListenerTest listener;
@@ -81,28 +81,6 @@
}
@Override
- public String getConfig(TargetConfig targetConfiguration) throws NetconfException {
- return null;
- }
-
- @Override
- public String getConfig(String targetConfiguration) throws NetconfException {
- return null;
- }
-
- @Override
- public String getConfig(TargetConfig targetConfiguration, String configurationFilterSchema)
- throws NetconfException {
- return null;
- }
-
- @Override
- public String getConfig(String targetConfiguration, String configurationFilterSchema)
- throws NetconfException {
- return null;
- }
-
- @Override
public boolean editConfig(String newConfiguration) throws NetconfException {
boolean result = true;
if (listener != null) {
@@ -112,7 +90,7 @@
}
@Override
- public boolean editConfig(TargetConfig targetConfiguration, String mode, String newConfiguration)
+ public boolean editConfig(DatastoreId targetConfiguration, String mode, String newConfiguration)
throws NetconfException {
boolean result = true;
if (listener != null) {
@@ -122,17 +100,7 @@
}
@Override
- public boolean editConfig(String targetConfiguration, String mode, String newConfiguration)
- throws NetconfException {
- boolean result = true;
- if (listener != null) {
- result = listener.verifyEditConfig(targetConfiguration, mode, newConfiguration);
- }
- return result;
- }
-
- @Override
- public boolean copyConfig(TargetConfig targetConfiguration, String newConfiguration)
+ public boolean copyConfig(DatastoreId targetConfiguration, String newConfiguration)
throws NetconfException {
return false;
}
@@ -144,17 +112,11 @@
}
@Override
- public boolean deleteConfig(TargetConfig targetConfiguration) throws NetconfException {
+ public boolean deleteConfig(DatastoreId targetConfiguration) throws NetconfException {
return false;
}
@Override
- public boolean deleteConfig(String targetConfiguration) throws NetconfException {
- return false;
- }
-
-
- @Override
public void startSubscription() throws NetconfException {
}
@@ -172,12 +134,12 @@
}
@Override
- public boolean lock(String configType) throws NetconfException {
+ public boolean lock(DatastoreId configType) throws NetconfException {
return false;
}
@Override
- public boolean unlock(String configType) throws NetconfException {
+ public boolean unlock(DatastoreId configType) throws NetconfException {
return false;
}
@@ -202,15 +164,6 @@
}
@Override
- public String getServerCapabilities() {
- return null;
- }
-
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- }
-
- @Override
public void checkAndReestablish() throws NetconfException {
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfigTest.java
index 02136f8..f12b631 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltAlertConfigTest.java
@@ -19,7 +19,7 @@
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.DatastoreId;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -31,7 +31,7 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtilityMock.*;
-import static org.onosproject.netconf.TargetConfig.*;
+import static org.onosproject.netconf.DatastoreId.*;
/**
@@ -232,11 +232,11 @@
@Override
public boolean verifyEditConfig(String targetConfiguration, String mode, String newConfiguration) {
- return verifyEditConfig(TargetConfig.valueOf(targetConfiguration), mode, newConfiguration);
+ return verifyEditConfig(DatastoreId.datastore(targetConfiguration), mode, newConfiguration);
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
boolean result;
assertTrue("Incorrect target", target.equals(RUNNING));
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfigTest.java
index 3365bb8..0605ba7 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltControllerConfigTest.java
@@ -23,8 +23,7 @@
import org.onosproject.net.behaviour.ControllerInfo;
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
-
+import org.onosproject.netconf.DatastoreId;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -191,7 +190,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
return false;
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfigTest.java
index c01b448..fb8b373 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltFwdlConfigTest.java
@@ -18,7 +18,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
@@ -165,7 +165,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
return false;
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfigTest.java
index 2368eb1..0214627 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNeConfigTest.java
@@ -18,8 +18,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
-
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtilityMock.*;
@@ -81,7 +80,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
return false;
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfigTest.java
index 5e9c55c..53e19d3 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltNniLinkConfigTest.java
@@ -18,14 +18,13 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
-
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtilityMock.*;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
/**
* Unit tests for methods of FujitsuVoltPonLinkConfig.
@@ -216,7 +215,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
boolean result;
assertTrue("Incorrect target", target.equals(RUNNING));
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfigTest.java
index 5778a1b..aecf2c1 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuConfigTest.java
@@ -18,8 +18,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
-
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
@@ -345,7 +344,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
return false;
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfigTest.java
index 7268d9a..307af6a 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltOnuOperConfigTest.java
@@ -18,7 +18,7 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
@@ -220,7 +220,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
return false;
}
diff --git a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfigTest.java b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfigTest.java
index a1d7f7a..ba141b2 100644
--- a/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfigTest.java
+++ b/drivers/fujitsu/src/test/java/org/onosproject/drivers/fujitsu/FujitsuVoltPonLinkConfigTest.java
@@ -18,14 +18,13 @@
import org.junit.Before;
import org.junit.Test;
-import org.onosproject.netconf.TargetConfig;
-
+import org.onosproject.netconf.DatastoreId;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.onosproject.drivers.fujitsu.FujitsuVoltXmlUtilityMock.*;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
+import static org.onosproject.netconf.DatastoreId.RUNNING;
/**
* Unit tests for methods of FujitsuVoltPonLinkConfig.
@@ -227,7 +226,7 @@
}
@Override
- public boolean verifyEditConfig(TargetConfig target, String mode, String request) {
+ public boolean verifyEditConfig(DatastoreId target, String mode, String request) {
boolean result;
assertTrue("Incorrect target", target.equals(RUNNING));
diff --git a/drivers/huawei/driver/pom.xml b/drivers/huawei/driver/pom.xml
index 778e87a..0d3a9fe 100644
--- a/drivers/huawei/driver/pom.xml
+++ b/drivers/huawei/driver/pom.xml
@@ -61,7 +61,7 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/drivers/juniper/features.xml b/drivers/juniper/features.xml
index 2a5e81b..c6e4911 100644
--- a/drivers/juniper/features.xml
+++ b/drivers/juniper/features.xml
@@ -29,7 +29,7 @@
mvn:${project.groupId}/onos-drivers-utilities/${project.version}
</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}
</bundle>
</feature>
</features>
diff --git a/drivers/juniper/pom.xml b/drivers/juniper/pom.xml
index eb1c12c..8c17f8d 100644
--- a/drivers/juniper/pom.xml
+++ b/drivers/juniper/pom.xml
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/drivers/microsemi/pom.xml b/drivers/microsemi/pom.xml
index 8d3889a..6459186 100644
--- a/drivers/microsemi/pom.xml
+++ b/drivers/microsemi/pom.xml
@@ -66,7 +66,7 @@
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
index bbdd614..087af0c 100644
--- a/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
+++ b/drivers/microsemi/src/main/java/org/onosproject/drivers/microsemi/NetconfConfigGetter.java
@@ -16,6 +16,7 @@
package org.onosproject.drivers.microsemi;
+import static org.onosproject.netconf.DatastoreId.datastore;
import static org.slf4j.LoggerFactory.getLogger;
import java.io.IOException;
@@ -66,7 +67,8 @@
return UNABLE_TO_READ_CONFIG;
}
try {
- return controller.getDevicesMap().get(ofDeviceId).getSession().getConfig(type.replace("cfgType=", ""));
+ return controller.getDevicesMap().get(ofDeviceId).getSession()
+ .getConfig(datastore(type.replace("cfgType=", "")));
} catch (IOException e) {
log.error("Configuration could not be retrieved {}", e.getMessage());
}
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
index 244934b..8068cff 100644
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
+++ b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/MockNetconfSessionEa1000.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.drivers.microsemi.yang;
-import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
@@ -24,12 +23,11 @@
import org.onosproject.netconf.NetconfDeviceInfo;
import org.onosproject.netconf.NetconfDeviceOutputEventListener;
import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.NetconfSession;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.NetconfSessionAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class MockNetconfSessionEa1000 implements NetconfSession {
+public class MockNetconfSessionEa1000 extends NetconfSessionAdapter {
private static final Logger log = LoggerFactory
.getLogger(MockNetconfSessionEa1000.class);
@@ -822,7 +820,6 @@
return reply;
}
-
@Override
public String getConfig(DatastoreId targetConfiguration, String configurationSchema) throws NetconfException {
StringBuilder rpc = new StringBuilder(XML_HEADER);
@@ -888,7 +885,7 @@
@Override
public boolean copyConfig(String targetConfiguration, String newConfiguration) throws NetconfException {
- return copyConfig(TargetConfig.valueOf(targetConfiguration), newConfiguration);
+ return copyConfig(DatastoreId.datastore(targetConfiguration), newConfiguration);
}
@Override
@@ -933,18 +930,6 @@
}
@Override
- public String getServerCapabilities() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) {
// TODO Auto-generated method stub
diff --git a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/package-info.java b/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/package-info.java
deleted file mode 100644
index 7acdee9..0000000
--- a/drivers/microsemi/src/test/java/org/onosproject/drivers/microsemi/yang/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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 for Microsemi device drivers support for NETCONF for EA1000.
- */
-package org.onosproject.drivers.microsemi.yang;
\ No newline at end of file
diff --git a/drivers/netconf/features.xml b/drivers/netconf/features.xml
index 66b0bce..5f2b7c4 100644
--- a/drivers/netconf/features.xml
+++ b/drivers/netconf/features.xml
@@ -23,6 +23,6 @@
<bundle>mvn:${project.groupId}/onos-drivers-utilities/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</bundle>
</feature>
</features>
diff --git a/drivers/netconf/pom.xml b/drivers/netconf/pom.xml
index 5dd841c..81cf922 100644
--- a/drivers/netconf/pom.xml
+++ b/drivers/netconf/pom.xml
@@ -44,7 +44,7 @@
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
index 446a0e2..2739872 100644
--- a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
+++ b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfConfigGetter.java
@@ -19,9 +19,9 @@
import com.google.common.base.Preconditions;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.ConfigGetter;
-import org.onosproject.netconf.TargetConfig;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfController;
import org.slf4j.Logger;
@@ -56,7 +56,7 @@
return controller.getDevicesMap().
get(ofDeviceId).
getSession().
- getConfig(TargetConfig.valueOf(type));
+ getConfig(DatastoreId.datastore(type));
} catch (IOException e) {
log.error("Configuration could not be retrieved {}",
e.getMessage());
diff --git a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
index bce3b6d..6a8710d 100644
--- a/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
+++ b/drivers/netconf/src/main/java/org/onosproject/drivers/netconf/NetconfControllerConfig.java
@@ -24,6 +24,7 @@
import org.onosproject.net.behaviour.ControllerInfo;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
import org.onosproject.net.driver.DriverHandler;
+import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfController;
import org.onosproject.netconf.NetconfDevice;
@@ -35,7 +36,6 @@
import java.util.ArrayList;
import java.util.List;
-import static org.onosproject.netconf.TargetConfig.RUNNING;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -59,7 +59,7 @@
if (mastershipService.isLocalMaster(deviceId)) {
try {
String reply = controller.getNetconfDevice(deviceId).getSession().
- getConfig(RUNNING);
+ getConfig(DatastoreId.RUNNING);
log.debug("Reply XML {}", reply);
controllers.addAll(XmlConfigParser.parseStreamControllers(XmlConfigParser.
loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8)))));
@@ -87,7 +87,7 @@
String config = null;
try {
- String reply = device.getSession().getConfig(RUNNING);
+ String reply = device.getSession().getConfig(DatastoreId.RUNNING);
log.info("reply XML {}", reply);
config = XmlConfigParser.createControllersConfig(
XmlConfigParser.loadXml(getClass().getResourceAsStream("controllers.xml")),
diff --git a/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/MockNetconfSession.java b/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/MockNetconfSession.java
index 1a973dd..155a5a0 100644
--- a/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/MockNetconfSession.java
+++ b/drivers/netconf/src/test/java/org/onosproject/drivers/netconf/MockNetconfSession.java
@@ -15,20 +15,19 @@
*/
package org.onosproject.drivers.netconf;
-import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
+import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfDeviceInfo;
import org.onosproject.netconf.NetconfDeviceOutputEventListener;
import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.NetconfSession;
-import org.onosproject.netconf.TargetConfig;
+import org.onosproject.netconf.NetconfSessionAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class MockNetconfSession implements NetconfSession {
+public class MockNetconfSession extends NetconfSessionAdapter {
private static final Logger log = LoggerFactory
.getLogger(MockNetconfSession.class);
@@ -158,23 +157,13 @@
@Override
- public String getConfig(String targetConfiguration, String configurationSchema) throws NetconfException {
- return getConfig(TargetConfig.valueOf(targetConfiguration));
- }
-
- @Override
- public String getConfig(String targetConfiguration) throws NetconfException {
- return getConfig(TargetConfig.valueOf(targetConfiguration), null);
- }
-
- @Override
- public String getConfig(TargetConfig netconfTargetConfig)
+ public String getConfig(DatastoreId netconfTargetConfig)
throws NetconfException {
return getConfig(netconfTargetConfig, null);
}
@Override
- public String getConfig(TargetConfig netconfTargetConfig, String configurationFilterSchema)
+ public String getConfig(DatastoreId netconfTargetConfig, String configurationFilterSchema)
throws NetconfException {
StringBuilder rpc = new StringBuilder(XML_HEADER);
rpc.append("<rpc ");
@@ -201,7 +190,7 @@
}
@Override
- public boolean editConfig(TargetConfig netconfTargetConfig, String mode, String newConfiguration)
+ public boolean editConfig(DatastoreId netconfTargetConfig, String mode, String newConfiguration)
throws NetconfException {
newConfiguration = newConfiguration.trim();
StringBuilder rpc = new StringBuilder(XML_HEADER);
@@ -234,17 +223,11 @@
@Override
public boolean editConfig(String newConfiguration) throws NetconfException {
- return editConfig(TargetConfig.RUNNING, null, newConfiguration);
+ return editConfig(DatastoreId.RUNNING, null, newConfiguration);
}
@Override
- public boolean editConfig(String targetConfiguration, String mode, String newConfiguration)
- throws NetconfException {
- return editConfig(TargetConfig.valueOf(targetConfiguration), mode, newConfiguration);
- }
-
- @Override
- public boolean copyConfig(TargetConfig netconfTargetConfig, String newConfiguration) throws NetconfException {
+ public boolean copyConfig(DatastoreId netconfTargetConfig, String newConfiguration) throws NetconfException {
newConfiguration = newConfiguration.trim();
StringBuilder rpc = new StringBuilder(XML_HEADER);
rpc.append(RPC_OPEN);
@@ -271,11 +254,11 @@
@Override
public boolean copyConfig(String targetConfiguration, String newConfiguration) throws NetconfException {
- return copyConfig(TargetConfig.valueOf(targetConfiguration), newConfiguration);
+ return copyConfig(DatastoreId.datastore(targetConfiguration), newConfiguration);
}
@Override
- public boolean deleteConfig(TargetConfig netconfTargetConfig) throws NetconfException {
+ public boolean deleteConfig(DatastoreId netconfTargetConfig) throws NetconfException {
StringBuilder rpc = new StringBuilder(XML_HEADER);
rpc.append(RPC_OPEN);
rpc.append(MESSAGE_ID_STRING);
@@ -297,11 +280,6 @@
}
@Override
- public boolean deleteConfig(String targetConfiguration) throws NetconfException {
- return deleteConfig(TargetConfig.valueOf(targetConfiguration));
- }
-
- @Override
public void startSubscription() throws NetconfException {
// TODO Auto-generated method stub
@@ -320,18 +298,6 @@
}
@Override
- public boolean lock(String configType) throws NetconfException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean unlock(String configType) throws NetconfException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
public boolean lock() throws NetconfException {
// TODO Auto-generated method stub
return false;
@@ -355,18 +321,6 @@
}
@Override
- public String getServerCapabilities() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) {
// TODO Auto-generated method stub
diff --git a/drivers/oplink/features.xml b/drivers/oplink/features.xml
index 1e16fa0..a716991 100644
--- a/drivers/oplink/features.xml
+++ b/drivers/oplink/features.xml
@@ -23,6 +23,6 @@
<bundle>mvn:${project.groupId}/onos-drivers-utilities/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</bundle>
</feature>
</features>
diff --git a/drivers/oplink/pom.xml b/drivers/oplink/pom.xml
index 6041356..ce4eaf0 100644
--- a/drivers/oplink/pom.xml
+++ b/drivers/oplink/pom.xml
@@ -51,7 +51,7 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/drivers/p4runtime/BUCK b/drivers/p4runtime/BUCK
index 59a5d60..57079be 100644
--- a/drivers/p4runtime/BUCK
+++ b/drivers/p4runtime/BUCK
@@ -26,5 +26,6 @@
'org.onosproject.generaldeviceprovider',
'org.onosproject.protocols.p4runtime',
'org.onosproject.p4runtime',
+ 'org.onosproject.drivers',
],
)
diff --git a/features/BUCK b/features/BUCK
index 8094ff9..bb87afc 100644
--- a/features/BUCK
+++ b/features/BUCK
@@ -36,6 +36,8 @@
'//lib:commons-io',
'//lib:jersey-client',
'//lib:mapdb',
+ '//lib:bcpkix-jdk15on',
+ '//lib:bcprov-jdk15on',
]
)
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualMeterStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualMeterStore.java
index 3b5d122..3042f33 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualMeterStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualMeterStore.java
@@ -19,9 +19,11 @@
import com.google.common.collect.Collections2;
import com.google.common.collect.Maps;
import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.NodeId;
import org.onosproject.incubator.net.virtual.NetworkId;
@@ -53,7 +55,8 @@
* Implementation of the virtual meter store for a single instance.
*/
//TODO: support distributed meter store for virtual networks
-
+@Component(immediate = true)
+@Service
public class SimpleVirtualMeterStore
extends AbstractVirtualStore<MeterEvent, MeterStoreDelegate>
implements VirtualNetworkMeterStore {
diff --git a/lib/BUCK b/lib/BUCK
index 87add7d..1ca9fbb 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Thu, 31 Aug 2017 21:26:06 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Sun, 3 Sep 2017 12:12:12 GMT. Do not edit this file manually. *****
# ***** Use onos-lib-gen *****
pass_thru_pom(
@@ -1491,3 +1491,21 @@
visibility = [ 'PUBLIC' ],
)
+remote_jar (
+ name = 'bcpkix-jdk15on',
+ out = 'bcpkix-jdk15on-1.58.jar',
+ url = 'mvn:org.bouncycastle:bcpkix-jdk15on:jar:1.58',
+ sha1 = '15a760a039b040e767a75c77ffcc4ff62558f903',
+ maven_coords = 'org.bouncycastle:bcpkix-jdk15on:1.58',
+ visibility = [ 'PUBLIC' ],
+)
+
+remote_jar (
+ name = 'bcprov-jdk15on',
+ out = 'bcprov-jdk15on-1.58.jar',
+ url = 'mvn:org.bouncycastle:bcprov-jdk15on:jar:1.58',
+ sha1 = '2c9aa1c4e3372b447ba5daabade4adf2a2264b12',
+ maven_coords = 'org.bouncycastle:bcprov-jdk15on:1.58',
+ visibility = [ 'PUBLIC' ],
+)
+
diff --git a/lib/deps.json b/lib/deps.json
index 35282c4..7ed72bc 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -266,6 +266,8 @@
"google-truth-0.28": "mvn:com.google.truth:truth:0.28",
"google-code-findbugs-3.0.0": "mvn:com.google.code.findbugs:jsr305:3.0.0",
"google-errorprone-2.0.19": "mvn:com.google.errorprone:error_prone_annotations:2.0.19",
- "google-instrumentation-0.3.0": "mvn:com.google.instrumentation:instrumentation-api:0.3.0"
+ "google-instrumentation-0.3.0": "mvn:com.google.instrumentation:instrumentation-api:0.3.0",
+ "bcpkix-jdk15on": "mvn:org.bouncycastle:bcpkix-jdk15on:1.58",
+ "bcprov-jdk15on": "mvn:org.bouncycastle:bcprov-jdk15on:1.58"
}
}
diff --git a/lib/pom.xml b/lib/pom.xml
index af013ea..55eea9a 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -49,6 +49,7 @@
<slf4j.version>1.7.21</slf4j.version>
<guava.version>22.0</guava.version>
<commons.io.version>2.4</commons.io.version>
+ <bouncycastle.version>1.58</bouncycastle.version>
<!-- TODO argLine was originally added maven-surfire-plugin configuration
to fix locale errors for non-US developers. However, it breaks
SonarQube's test coverage, so moving here for now. -->
@@ -184,6 +185,25 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.sshd</groupId>
+ <artifactId>sshd-core</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ <version>${bouncycastle.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ <version>${bouncycastle.version}</version>
+ </dependency>
+
+
<!-- Web related -->
<dependency>
<groupId>javax.servlet</groupId>
diff --git a/protocols/netconf/api/pom.xml b/protocols/netconf/api/pom.xml
index c758a8e..d1609a4 100644
--- a/protocols/netconf/api/pom.xml
+++ b/protocols/netconf/api/pom.xml
@@ -21,11 +21,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf</artifactId>
+ <artifactId>onos-protocols-netconf</artifactId>
<version>1.12.0-SNAPSHOT</version>
</parent>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<packaging>bundle</packaging>
<description>ONOS NETCONF plugin API</description>
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
index 06c8b9c..420a961 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSession.java
@@ -20,12 +20,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* NETCONF session object that allows NETCONF operations on top with the physical
@@ -100,44 +96,7 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default String getConfig(DatastoreId netconfTargetConfig) throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return getConfig(netconfTargetConfig.id());
- }
-
- /**
- * Retrieves the specified configuration.
- *
- * @param netconfTargetConfig the type of configuration to retrieve.
- * @return specified configuration.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration parameter instead
- */
- @Deprecated
- default String getConfig(TargetConfig netconfTargetConfig) throws NetconfException {
- return getConfig(TargetConfig.toDatastoreId(netconfTargetConfig));
- }
-
- /**
- * Retrieves the specified configuration.
- *
- * @param netconfTargetConfig the type of configuration to retrieve.
- * @return specified configuration.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration parameter instead
- */
- @Deprecated
- default String getConfig(String netconfTargetConfig) throws NetconfException {
- return getConfig(TargetConfig.toDatastoreId(netconfTargetConfig));
- }
-
+ String getConfig(DatastoreId netconfTargetConfig) throws NetconfException;
/**
* Retrieves part of the specified configuration based on the filterSchema.
@@ -149,55 +108,9 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default String getConfig(DatastoreId netconfTargetConfig,
+ String getConfig(DatastoreId netconfTargetConfig,
String configurationFilterSchema)
- throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return getConfig(netconfTargetConfig.id(), configurationFilterSchema);
- }
-
-
- /**
- * Retrieves part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the type of configuration to retrieve.
- * @param configurationFilterSchema XML schema to filter the configuration
- * elements we are interested in
- * @return device running configuration.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfig enum parameter instead
- */
- @Deprecated
- default String getConfig(String netconfTargetConfig, String configurationFilterSchema)
- throws NetconfException {
- return getConfig(TargetConfig.toDatastoreId(netconfTargetConfig),
- configurationFilterSchema);
- }
-
- /**
- * Retrieves part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the type of configuration to retrieve.
- * @param configurationFilterSchema XML schema to filter the configuration
- * elements we are interested in
- * @return device running configuration.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfig enum parameter instead
- */
- @Deprecated
- default String getConfig(TargetConfig netconfTargetConfig, String configurationFilterSchema)
- throws NetconfException {
- return getConfig(TargetConfig.toDatastoreId(netconfTargetConfig),
- configurationFilterSchema);
- }
-
+ throws NetconfException;
/**
* Retrieves part of the specified configuration based on the filterSchema.
@@ -207,7 +120,6 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
-
boolean editConfig(String newConfiguration) throws NetconfException;
/**
@@ -220,54 +132,8 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean editConfig(DatastoreId netconfTargetConfig, String mode, String newConfiguration)
- throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return editConfig(netconfTargetConfig.id(), mode, newConfiguration);
- }
-
- /**
- * Retrieves part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the targetConfiguration to change
- * @param mode selected mode to change the configuration
- * @param newConfiguration configuration to set
- * @return true if the configuration was edited correctly
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration enum parameter instead
- */
- @Deprecated
- default boolean editConfig(String netconfTargetConfig, String mode, String newConfiguration)
- throws NetconfException {
- return editConfig(TargetConfig.toDatastoreId(netconfTargetConfig),
- mode,
- newConfiguration);
- }
-
- /**
- * Retrieves part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the targetConfiguration to change
- * @param mode selected mode to change the configuration
- * @param newConfiguration configuration to set
- * @return true if the configuration was edited correctly
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration enum parameter instead
- */
- @Deprecated
- default boolean editConfig(TargetConfig netconfTargetConfig, String mode, String newConfiguration)
- throws NetconfException {
- return editConfig(TargetConfig.toDatastoreId(netconfTargetConfig),
- mode,
- newConfiguration);
- }
+ boolean editConfig(DatastoreId netconfTargetConfig, String mode, String newConfiguration)
+ throws NetconfException;
/**
* Copies the configuration between configuration datastores.
@@ -280,14 +146,8 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean copyConfig(DatastoreId destination, DatastoreId source)
- throws NetconfException {
- // default implementation provided for backward compatibility
- // but this API should be implemented overriding the default
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return copyConfig(destination.id(), source.id());
- }
+ boolean copyConfig(DatastoreId destination, DatastoreId source)
+ throws NetconfException;
/**
* Copies the new configuration, an Url or a complete configuration xml tree
@@ -300,14 +160,8 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean copyConfig(DatastoreId netconfTargetConfig, String newConfiguration)
- throws NetconfException {
- // default implementation provided for backward compatibility
- // but this API should be implemented overriding the default
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return copyConfig(netconfTargetConfig.id(), newConfiguration);
- }
+ boolean copyConfig(DatastoreId netconfTargetConfig, String newConfiguration)
+ throws NetconfException;
/**
* Copies the new configuration, an Url or a complete configuration xml tree
@@ -324,25 +178,6 @@
throws NetconfException;
/**
- * Copies the new configuration, an Url or a complete configuration xml tree
- * to the target configuration.
- * The target configuration can't be the running one
- *
- * @param netconfTargetConfig the type of configuration to retrieve.
- * @param newConfiguration configuration to set
- * @return true if the configuration was copied correctly
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration enum parameter instead
- */
- @Deprecated
- default boolean copyConfig(TargetConfig netconfTargetConfig, String newConfiguration)
- throws NetconfException {
- return copyConfig(TargetConfig.toDatastoreId(netconfTargetConfig), newConfiguration);
- }
-
- /**
* Deletes part of the specified configuration based on the filterSchema.
*
* @param netconfTargetConfig the name of the configuration to delete
@@ -350,43 +185,7 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean deleteConfig(DatastoreId netconfTargetConfig) throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return deleteConfig(netconfTargetConfig.id());
- }
-
- /**
- * Deletes part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the name of the configuration to delete
- * @return true if the configuration was deleted correctly
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration enum parameter instead
- */
- @Deprecated
- default boolean deleteConfig(String netconfTargetConfig) throws NetconfException {
- return deleteConfig(TargetConfig.toDatastoreId(netconfTargetConfig));
- }
-
- /**
- * Deletes part of the specified configuration based on the filterSchema.
- *
- * @param netconfTargetConfig the name of the configuration to delete
- * @return true if the configuration was copied correctly
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration enum parameter instead
- */
- @Deprecated
- default boolean deleteConfig(TargetConfig netconfTargetConfig) throws NetconfException {
- return deleteConfig(TargetConfig.toDatastoreId(netconfTargetConfig));
- }
+ boolean deleteConfig(DatastoreId netconfTargetConfig) throws NetconfException;
/**
* Starts subscription to the device's notifications.
@@ -419,28 +218,7 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean lock(DatastoreId datastore) throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return lock(datastore.id());
- }
-
- /**
- * Locks the specified configuration.
- *
- * @param configType type of configuration to be locked
- * @return true if successful.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration parameter instead
- */
- @Deprecated
- default boolean lock(String configType) throws NetconfException {
- return lock(TargetConfig.toDatastoreId(configType));
- }
+ boolean lock(DatastoreId datastore) throws NetconfException;
/**
* Unlocks the specified configuration.
@@ -450,28 +228,7 @@
* @throws NetconfException when there is a problem in the communication process on
* the underlying connection
*/
- default boolean unlock(DatastoreId datastore) throws NetconfException {
- // default implementation provided for backward compatibility
- // this API is the one, which should be implemented
- // TODO default implementation here should be removed after
- // deprecation of the other 2 variants.
- return unlock(datastore.id());
- }
-
- /**
- * Unlocks the specified configuration.
- *
- * @param configType type of configuration to be locked
- * @return true if successful.
- * @throws NetconfException when there is a problem in the communication process on
- * the underlying connection
- * @deprecated - 1.10.0 Kingfisher use method overload that accepts
- * org.onosproject.netconf.TargetConfiguration parameter instead
- */
- @Deprecated
- default boolean unlock(String configType) throws NetconfException {
- return unlock(TargetConfig.toDatastoreId(configType));
- }
+ boolean unlock(DatastoreId datastore) throws NetconfException;
/**
* Locks the running configuration.
@@ -519,40 +276,8 @@
* @return Network capabilities as strings in a Set.
*
* @since 1.10.0
- * Note: default implementation provided with the interface
- * will be removed when {@code getServerCapabilities()} reaches
- * deprecation grace period.
*/
- default Set<String> getDeviceCapabilitiesSet() {
- // default implementation should be removed in the future
- Set<String> capabilities = new LinkedHashSet<>();
- Matcher capabilityMatcher =
- Pattern.compile("<capability>\\s*(.*?)\\s*</capability>")
- .matcher(getServerCapabilities());
- while (capabilityMatcher.find()) {
- capabilities.add(capabilityMatcher.group(1));
- }
- return capabilities;
- }
-
- /**
- * Gets the capabilities of the Netconf server (remote device) associated
- * to this session.
- *
- * @return Network capabilities as a string.
- * @deprecated 1.10.0 use {@link #getDeviceCapabilitiesSet()} instead
- */
- @Deprecated
- String getServerCapabilities();
-
- /**
- * Sets the ONOS side capabilities.
- *
- * @param capabilities list of capabilities the device has.
- * @deprecated 1.10.0 use {@link #setOnosCapabilities(Iterable)} instead
- */
- @Deprecated
- void setDeviceCapabilities(List<String> capabilities);
+ Set<String> getDeviceCapabilitiesSet();
/**
* Checks the state of the underlying SSH session and connection
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSessionAdapter.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSessionAdapter.java
index a399d92..6ca84c7 100644
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSessionAdapter.java
+++ b/protocols/netconf/api/src/main/java/org/onosproject/netconf/NetconfSessionAdapter.java
@@ -15,7 +15,8 @@
*/
package org.onosproject.netconf;
-import java.util.List;
+import java.util.Collections;
+import java.util.Set;
import java.util.concurrent.CompletableFuture;
import org.onlab.util.Tools;
@@ -34,10 +35,6 @@
}
@Override
- public void setDeviceCapabilities(List<String> capabilities) {
- }
-
- @Override
public String requestSync(String request) throws NetconfException {
return null;
}
@@ -58,11 +55,6 @@
}
@Override
- public String getServerCapabilities() {
- return null;
- }
-
- @Override
public String get(String filterSchema, String withDefaultsMode)
throws NetconfException {
return null;
@@ -88,6 +80,19 @@
}
@Override
+ public boolean copyConfig(DatastoreId destination, DatastoreId source)
+ throws NetconfException {
+ return true;
+ }
+
+ @Override
+ public boolean copyConfig(DatastoreId netconfTargetConfig,
+ String newConfiguration)
+ throws NetconfException {
+ return true;
+ }
+
+ @Override
public boolean copyConfig(String netconfTargetConfig,
String newConfiguration)
throws NetconfException {
@@ -102,4 +107,45 @@
@Override
public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) {
}
+
+ @Override
+ public String getConfig(DatastoreId netconfTargetConfig)
+ throws NetconfException {
+ return null;
+ }
+
+ @Override
+ public String getConfig(DatastoreId netconfTargetConfig,
+ String configurationFilterSchema)
+ throws NetconfException {
+ return null;
+ }
+
+ @Override
+ public boolean editConfig(DatastoreId netconfTargetConfig, String mode,
+ String newConfiguration)
+ throws NetconfException {
+ return true;
+ }
+
+ @Override
+ public boolean deleteConfig(DatastoreId netconfTargetConfig)
+ throws NetconfException {
+ return true;
+ }
+
+ @Override
+ public boolean lock(DatastoreId datastore) throws NetconfException {
+ return true;
+ }
+
+ @Override
+ public boolean unlock(DatastoreId datastore) throws NetconfException {
+ return true;
+ }
+
+ @Override
+ public Set<String> getDeviceCapabilitiesSet() {
+ return Collections.emptySet();
+ }
}
\ No newline at end of file
diff --git a/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java b/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java
deleted file mode 100644
index 4314baf..0000000
--- a/protocols/netconf/api/src/main/java/org/onosproject/netconf/TargetConfig.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * 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.netconf;
-
-/**
- * @deprecated in 1.10.0 use TargetConfiguration instead
- * According to NETCONF RFC,
- * various additional configuration datastores may be defined by capabilities.
- */
-@Deprecated
-public enum TargetConfig {
- RUNNING("running"),
- CANDIDATE("candidate"),
- STARTUP("startup");
-
- private String name;
-
- TargetConfig(String name) {
- this.name = name;
- }
-
- public static TargetConfig toTargetConfig(String targetConfig) {
- return valueOf(targetConfig.toUpperCase());
- }
-
- public static DatastoreId toDatastoreId(String cfg) {
- return toDatastoreId(toTargetConfig(cfg));
- }
-
- public static DatastoreId toDatastoreId(TargetConfig cfg) {
- switch (cfg) {
- case CANDIDATE:
- return DatastoreId.CANDIDATE;
- case RUNNING:
- return DatastoreId.RUNNING;
- case STARTUP:
- return DatastoreId.STARTUP;
- default:
- return DatastoreId.datastore(cfg.name);
- }
- }
-
- @Override
- public String toString() {
- return this.name;
- }
-
-}
diff --git a/protocols/netconf/ctl/BUCK b/protocols/netconf/ctl/BUCK
index 2d79045..8abf233 100644
--- a/protocols/netconf/ctl/BUCK
+++ b/protocols/netconf/ctl/BUCK
@@ -6,6 +6,8 @@
'//cli:onos-cli',
'//lib:org.apache.karaf.shell.console',
'//lib:sshd-core',
+ '//lib:bcpkix-jdk15on',
+ '//lib:bcprov-jdk15on',
]
TEST_DEPS = [
diff --git a/protocols/netconf/ctl/pom.xml b/protocols/netconf/ctl/pom.xml
index c4108ae..736d62f 100644
--- a/protocols/netconf/ctl/pom.xml
+++ b/protocols/netconf/ctl/pom.xml
@@ -20,11 +20,11 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf</artifactId>
+ <artifactId>onos-protocols-netconf</artifactId>
<version>1.12.0-SNAPSHOT</version>
</parent>
- <artifactId>onos-netconf-ctl</artifactId>
+ <artifactId>onos-protocols-netconf-ctl</artifactId>
<packaging>bundle</packaging>
<description>ONOS NETCONF plugin controller</description>
@@ -41,7 +41,7 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -64,7 +64,6 @@
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
- <version>1.4.0</version>
</dependency>
<dependency>
@@ -78,53 +77,16 @@
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
+
</dependencies>
- <build>
- <plugins>
- <!--plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <filters>
- <filter>
- <artifact>ch.ethz.ganymed:ganymed-ssh2</artifact>
- <includes>
- <include>ch/ethz/ssh2/**</include>
- </includes>
- </filter>
- <filter>
- <artifact>org.jdom:jdom2</artifact>
- <includes>
- <include>org/jdom2/**</include>
- </includes>
- </filter>
- </filters>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- </execution>
- </executions>
- </plugin-->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Private-Package>ch.ethz.ssh2.*</Private-Package>
- <Embed-Dependecy>ganymed-ssh2</Embed-Dependecy>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java
deleted file mode 100644
index 1d36bc3..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/DefaultNetconfDevice.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import org.onosproject.netconf.NetconfDevice;
-import org.onosproject.netconf.NetconfDeviceInfo;
-import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.NetconfSession;
-import org.onosproject.netconf.NetconfSessionFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * Default implementation of a NETCONF device.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-public class DefaultNetconfDevice implements NetconfDevice {
-
- public static final Logger log = LoggerFactory
- .getLogger(DefaultNetconfDevice.class);
-
- private NetconfDeviceInfo netconfDeviceInfo;
- private boolean deviceState = true;
- protected NetconfSessionFactory sessionFactory = new SshNetconfSessionFactory();
- private NetconfSession netconfSession;
-
- /**
- * Creates a new default NETCONF device with the information provided.
- * The device gets created only if no exception is thrown while connecting to
- * it and establishing the NETCONF session.
- * @param deviceInfo information about the device to be created.
- * @throws NetconfException if there are problems in creating or establishing
- * the underlying NETCONF connection and session.
- */
- public DefaultNetconfDevice(NetconfDeviceInfo deviceInfo)
- throws NetconfException {
- netconfDeviceInfo = deviceInfo;
- try {
- netconfSession = sessionFactory.createNetconfSession(deviceInfo);
- } catch (IOException e) {
- deviceState = false;
- throw new NetconfException("Cannot create connection and session for device " +
- deviceInfo, e);
- }
- }
-
- @Override
- public boolean isActive() {
- return deviceState;
- }
-
- @Override
- public NetconfSession getSession() {
- return netconfSession;
- }
-
- @Override
- public void disconnect() {
- deviceState = false;
- try {
- netconfSession.close();
- } catch (IOException e) {
- log.warn("Cannot communicate with the device {} session already closed", netconfDeviceInfo);
- }
- }
-
- @Override
- public NetconfDeviceInfo getDeviceInfo() {
- return netconfDeviceInfo;
- }
-
- public class SshNetconfSessionFactory implements NetconfSessionFactory {
-
- @Override
- public NetconfSession createNetconfSession(NetconfDeviceInfo netconfDeviceInfo) throws NetconfException {
- return new NetconfSessionImpl(netconfDeviceInfo);
- }
- }
-
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java
deleted file mode 100644
index c26500f..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfControllerImpl.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Modified;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.Service;
-import org.onlab.packet.IpAddress;
-import org.onosproject.cfg.ComponentConfigService;
-import org.onosproject.net.AnnotationKeys;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.key.DeviceKey;
-import org.onosproject.net.key.DeviceKeyId;
-import org.onosproject.net.key.DeviceKeyService;
-import org.onosproject.net.key.UsernamePassword;
-import org.onosproject.netconf.NetconfController;
-import org.onosproject.netconf.NetconfDevice;
-import org.onosproject.netconf.NetconfDeviceFactory;
-import org.onosproject.netconf.NetconfDeviceInfo;
-import org.onosproject.netconf.NetconfDeviceListener;
-import org.onosproject.netconf.NetconfDeviceOutputEvent;
-import org.onosproject.netconf.NetconfDeviceOutputEventListener;
-import org.onosproject.netconf.NetconfException;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.onlab.util.Tools.get;
-import static org.onlab.util.Tools.groupedThreads;
-
-/**
- * The implementation of NetconfController.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-@Component(immediate = false, enabled = false)
-@Service
-public class NetconfControllerImpl implements NetconfController {
- private static final int DEFAULT_CONNECT_TIMEOUT_SECONDS = 5;
- private static final String PROP_NETCONF_CONNECT_TIMEOUT = "netconfConnectTimeout";
- @Property(name = PROP_NETCONF_CONNECT_TIMEOUT, intValue = DEFAULT_CONNECT_TIMEOUT_SECONDS,
- label = "Time (in seconds) to wait for a NETCONF connect.")
- protected static int netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS;
-
- private static final String PROP_NETCONF_REPLY_TIMEOUT = "netconfReplyTimeout";
- private static final int DEFAULT_REPLY_TIMEOUT_SECONDS = 5;
- @Property(name = PROP_NETCONF_REPLY_TIMEOUT, intValue = DEFAULT_REPLY_TIMEOUT_SECONDS,
- label = "Time (in seconds) waiting for a NetConf reply")
- protected static int netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected ComponentConfigService cfgService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceService deviceService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceKeyService deviceKeyService;
-
- public static final Logger log = LoggerFactory
- .getLogger(NetconfControllerImpl.class);
-
- private Map<DeviceId, NetconfDevice> netconfDeviceMap = new ConcurrentHashMap<>();
-
- private final NetconfDeviceOutputEventListener downListener = new DeviceDownEventListener();
-
- protected Set<NetconfDeviceListener> netconfDeviceListeners = new CopyOnWriteArraySet<>();
- protected NetconfDeviceFactory deviceFactory = new DefaultNetconfDeviceFactory();
-
- protected final ExecutorService executor =
- Executors.newCachedThreadPool(groupedThreads("onos/netconfdevicecontroller",
- "connection-reopen-%d", log));
-
- @Activate
- public void activate(ComponentContext context) {
- cfgService.registerProperties(getClass());
- modified(context);
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- cfgService.unregisterProperties(getClass(), false);
- netconfDeviceMap.clear();
- log.info("Stopped");
- }
-
- @Modified
- public void modified(ComponentContext context) {
- if (context == null) {
- netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
- netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS;
- log.info("No component configuration");
- return;
- }
-
- Dictionary<?, ?> properties = context.getProperties();
-
- int newNetconfReplyTimeout;
- int newNetconfConnectTimeout;
- try {
- String s = get(properties, PROP_NETCONF_REPLY_TIMEOUT);
- newNetconfReplyTimeout = isNullOrEmpty(s) ?
- netconfReplyTimeout : Integer.parseInt(s.trim());
-
- s = get(properties, PROP_NETCONF_CONNECT_TIMEOUT);
- newNetconfConnectTimeout = isNullOrEmpty(s) ?
- netconfConnectTimeout : Integer.parseInt(s.trim());
-
- } catch (NumberFormatException e) {
- log.warn("Component configuration had invalid value", e);
- return;
- }
-
- if (newNetconfConnectTimeout < 0) {
- log.warn("netconfConnectTimeout is invalid - less than 0");
- return;
- } else if (newNetconfReplyTimeout <= 0) {
- log.warn("netconfReplyTimeout is invalid - 0 or less.");
- return;
- }
-
- netconfReplyTimeout = newNetconfReplyTimeout;
- netconfConnectTimeout = newNetconfConnectTimeout;
- log.info("Settings: {} = {}, {} = {}",
- PROP_NETCONF_REPLY_TIMEOUT, netconfReplyTimeout, PROP_NETCONF_CONNECT_TIMEOUT, netconfConnectTimeout);
- }
-
- @Override
- public void addDeviceListener(NetconfDeviceListener listener) {
- if (!netconfDeviceListeners.contains(listener)) {
- netconfDeviceListeners.add(listener);
- }
- }
-
- @Override
- public void removeDeviceListener(NetconfDeviceListener listener) {
- netconfDeviceListeners.remove(listener);
- }
-
- @Override
- public NetconfDevice getNetconfDevice(DeviceId deviceInfo) {
- return netconfDeviceMap.get(deviceInfo);
- }
-
- @Override
- public NetconfDevice getNetconfDevice(IpAddress ip, int port) {
- for (DeviceId info : netconfDeviceMap.keySet()) {
- if (info.uri().getSchemeSpecificPart().equals(ip.toString() + ":" + port)) {
- return netconfDeviceMap.get(info);
- }
- }
- return null;
- }
-
- @Override
- public NetconfDevice connectDevice(DeviceId deviceId) throws NetconfException {
- if (netconfDeviceMap.containsKey(deviceId)) {
- log.debug("Device {} is already present", deviceId);
- return netconfDeviceMap.get(deviceId);
- } else {
- log.debug("Creating NETCONF device {}", deviceId);
- Device device = deviceService.getDevice(deviceId);
- String ip;
- int port;
- if (device != null) {
- ip = device.annotations().value("ipaddress");
- port = Integer.parseInt(device.annotations().value("port"));
- } else {
- String[] info = deviceId.toString().split(":");
- if (info.length == 3) {
- ip = info[1];
- port = Integer.parseInt(info[2]);
- } else {
- ip = Arrays.asList(info).stream().filter(el -> !el.equals(info[0])
- && !el.equals(info[info.length - 1]))
- .reduce((t, u) -> t + ":" + u)
- .get();
- log.debug("ip v6 {}", ip);
- port = Integer.parseInt(info[info.length - 1]);
- }
- }
- try {
- DeviceKey deviceKey = deviceKeyService.getDeviceKey(
- DeviceKeyId.deviceKeyId(deviceId.toString()));
- NetconfDeviceInfo deviceInfo = null;
- if (deviceKey.type() == DeviceKey.Type.USERNAME_PASSWORD) {
- UsernamePassword usernamepasswd = deviceKey.asUsernamePassword();
-
- deviceInfo = new NetconfDeviceInfo(usernamepasswd.username(),
- usernamepasswd.password(),
- IpAddress.valueOf(ip),
- port);
-
- } else if (deviceKey.type() == DeviceKey.Type.SSL_KEY) {
- String username = deviceKey.annotations().value(AnnotationKeys.USERNAME);
- String password = deviceKey.annotations().value(AnnotationKeys.PASSWORD);
- String sshkey = deviceKey.annotations().value(AnnotationKeys.SSHKEY);
-
- deviceInfo = new NetconfDeviceInfo(username,
- password,
- IpAddress.valueOf(ip),
- port,
- sshkey);
- } else {
- log.error("Unknown device key for device {}", deviceId);
- }
- NetconfDevice netconfDevicedevice = createDevice(deviceInfo);
- netconfDevicedevice.getSession().addDeviceOutputListener(downListener);
- return netconfDevicedevice;
- } catch (NullPointerException e) {
- throw new NetconfException("No Device Key for device " + deviceId, e);
- }
- }
- }
-
- @Override
- public void disconnectDevice(DeviceId deviceId, boolean remove) {
- if (!netconfDeviceMap.containsKey(deviceId)) {
- log.warn("Device {} is not present", deviceId);
- } else {
- stopDevice(deviceId, remove);
- }
- }
-
- private void stopDevice(DeviceId deviceId, boolean remove) {
- netconfDeviceMap.get(deviceId).disconnect();
- netconfDeviceMap.remove(deviceId);
- if (remove) {
- for (NetconfDeviceListener l : netconfDeviceListeners) {
- l.deviceRemoved(deviceId);
- }
- }
- }
-
- @Override
- public void removeDevice(DeviceId deviceId) {
- if (!netconfDeviceMap.containsKey(deviceId)) {
- log.warn("Device {} is not present", deviceId);
- for (NetconfDeviceListener l : netconfDeviceListeners) {
- l.deviceRemoved(deviceId);
- }
- } else {
- netconfDeviceMap.remove(deviceId);
- for (NetconfDeviceListener l : netconfDeviceListeners) {
- l.deviceRemoved(deviceId);
- }
- }
- }
-
- private NetconfDevice createDevice(NetconfDeviceInfo deviceInfo) throws NetconfException {
- NetconfDevice netconfDevice = deviceFactory.createNetconfDevice(deviceInfo);
- netconfDeviceMap.put(deviceInfo.getDeviceId(), netconfDevice);
- for (NetconfDeviceListener l : netconfDeviceListeners) {
- l.deviceAdded(deviceInfo.getDeviceId());
- }
- return netconfDevice;
- }
-
-
- @Override
- public Map<DeviceId, NetconfDevice> getDevicesMap() {
- return netconfDeviceMap;
- }
-
- @Override
- public Set<DeviceId> getNetconfDevices() {
- return netconfDeviceMap.keySet();
- }
-
-
- //Device factory for the specific NetconfDeviceImpl
- private class DefaultNetconfDeviceFactory implements NetconfDeviceFactory {
-
- @Override
- public NetconfDevice createNetconfDevice(NetconfDeviceInfo netconfDeviceInfo) throws NetconfException {
- return new DefaultNetconfDevice(netconfDeviceInfo);
- }
- }
-
- //Listener for closed session with devices, gets triggered whe devices goes down
- // or sends the endpattern ]]>]]>
- private class DeviceDownEventListener implements NetconfDeviceOutputEventListener {
-
- @Override
- public void event(NetconfDeviceOutputEvent event) {
- DeviceId did = event.getDeviceInfo().getDeviceId();
- if (event.type().equals(NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED)) {
- removeDevice(did);
- } else if (event.type().equals(NetconfDeviceOutputEvent.Type.SESSION_CLOSED)) {
- log.info("Trying to reestablish connection with device {}", did);
- executor.execute(() -> {
- try {
- netconfDeviceMap.get(did).getSession().checkAndReestablish();
- log.info("Connection with device {} was reestablished", did);
- } catch (NetconfException e) {
- log.error("The SSH connection with device {} couldn't be " +
- "reestablished due to {}. " +
- "Marking the device as unreachable", e.getMessage());
- log.debug("Complete exception: ", e);
- removeDevice(did);
- }
- });
- }
- }
-
- @Override
- public boolean isRelevant(NetconfDeviceOutputEvent event) {
- return getDevicesMap().containsKey(event.getDeviceInfo().getDeviceId());
- }
- }
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfDeviceOutputEventListenerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfDeviceOutputEventListenerImpl.java
deleted file mode 100644
index 9b093f2..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfDeviceOutputEventListenerImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import org.onosproject.netconf.NetconfDeviceInfo;
-import org.onosproject.netconf.NetconfDeviceOutputEvent;
-import org.onosproject.netconf.NetconfDeviceOutputEventListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Example of a listener for events that happen a Netconf session established
- * for a particular NETCONF device.
- *
- * @deprecated in 1.10.0 use FilteringNetconfDeviceOutputEventListener
- */
-@Deprecated
-public class NetconfDeviceOutputEventListenerImpl implements NetconfDeviceOutputEventListener {
-
- private static final Logger log =
- LoggerFactory.getLogger(NetconfDeviceOutputEventListenerImpl.class);
-
- private NetconfDeviceInfo deviceInfo;
-
- public NetconfDeviceOutputEventListenerImpl(NetconfDeviceInfo deviceInfo) {
- this.deviceInfo = deviceInfo;
- }
-
- @Override
- public void event(NetconfDeviceOutputEvent event) {
- switch (event.type()) {
- case DEVICE_REPLY:
- log.debug("Device {} has reply: {}", deviceInfo, event.getMessagePayload());
- break;
- case DEVICE_NOTIFICATION:
- log.info("Device {} has notification: {}", deviceInfo, event.getMessagePayload());
- break;
- case DEVICE_UNREGISTERED:
- log.warn("Device {} has closed session", deviceInfo);
- break;
- case DEVICE_ERROR:
- log.warn("Device {} has error: {}", deviceInfo, event.getMessagePayload());
- break;
- case SESSION_CLOSED:
- log.warn("Device {} has closed Session: {}", deviceInfo, event.getMessagePayload());
- break;
- default:
- log.warn("Wrong event type {} ", event.type());
- }
-
- }
-
- @Override
- public boolean isRelevant(NetconfDeviceOutputEvent event) {
- return deviceInfo.equals(event.getDeviceInfo());
- }
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionDelegate.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionDelegate.java
deleted file mode 100644
index a4a1f87..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionDelegate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import org.onosproject.netconf.NetconfDeviceOutputEvent;
-
-/**
- * Entity associated with a NetconfSessionImpl and capable of receiving notifications of
- * events about the session.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-public interface NetconfSessionDelegate {
-
- /**
- * Notifies the delegate via the specified event.
- *
- * @param event store generated event
- */
- void notify(NetconfDeviceOutputEvent event);
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
deleted file mode 100644
index a2c6a3d..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
+++ /dev/null
@@ -1,695 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import com.google.common.annotations.Beta;
-import ch.ethz.ssh2.Connection;
-import ch.ethz.ssh2.Session;
-import ch.ethz.ssh2.channel.Channel;
-import com.google.common.base.Preconditions;
-import org.onosproject.netconf.TargetConfig;
-import org.onosproject.netconf.NetconfDeviceInfo;
-import org.onosproject.netconf.NetconfDeviceOutputEvent;
-import org.onosproject.netconf.NetconfDeviceOutputEventListener;
-import org.onosproject.netconf.NetconfException;
-import org.onosproject.netconf.NetconfSession;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.regex.Pattern;
-
-
-/**
- * Implementation of a NETCONF session to talk to a device.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-public class NetconfSessionImpl implements NetconfSession {
-
- private static final Logger log = LoggerFactory
- .getLogger(NetconfSessionImpl.class);
-
- private static final String ENDPATTERN = "]]>]]>";
- private static final String MESSAGE_ID_STRING = "message-id";
- private static final String HELLO = "<hello";
- private static final String NEW_LINE = "\n";
- private static final String END_OF_RPC_OPEN_TAG = "\">";
- private static final String EQUAL = "=";
- private static final String NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\"";
- private static final String RPC_OPEN = "<rpc ";
- private static final String RPC_CLOSE = "</rpc>";
- private static final String GET_OPEN = "<get>";
- private static final String GET_CLOSE = "</get>";
- private static final String WITH_DEFAULT_OPEN = "<with-defaults ";
- private static final String WITH_DEFAULT_CLOSE = "</with-defaults>";
- private static final String DEFAULT_OPERATION_OPEN = "<default-operation>";
- private static final String DEFAULT_OPERATION_CLOSE = "</default-operation>";
- private static final String SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">";
- private static final String SUBTREE_FILTER_CLOSE = "</filter>";
- private static final String EDIT_CONFIG_OPEN = "<edit-config>";
- private static final String EDIT_CONFIG_CLOSE = "</edit-config>";
- private static final String TARGET_OPEN = "<target>";
- private static final String TARGET_CLOSE = "</target>";
- private static final String CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">";
- private static final String CONFIG_CLOSE = "</config>";
- private static final String XML_HEADER =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- private static final String NETCONF_BASE_NAMESPACE =
- "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"";
- private static final String NETCONF_WITH_DEFAULTS_NAMESPACE =
- "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\"";
- private static final String SUBSCRIPTION_SUBTREE_FILTER_OPEN =
- "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">";
-
- private static Pattern msgIdPattern = Pattern.compile("(message-id=\"[0-9]+\")");
-
- private final AtomicInteger messageIdInteger = new AtomicInteger(0);
- private Connection netconfConnection;
- private NetconfDeviceInfo deviceInfo;
- private Session sshSession;
- private boolean connectionActive;
- private List<String> deviceCapabilities =
- Collections.singletonList("urn:ietf:params:netconf:base:1.0");
- private String serverCapabilities;
- private NetconfStreamHandler streamHandler;
- private Map<Integer, CompletableFuture<String>> replies;
- private List<String> errorReplies;
- private boolean subscriptionConnected = false;
- private String notificationFilterSchema = null;
-
- private int connectTimeout;
- private int replyTimeout;
-
-
- public NetconfSessionImpl(NetconfDeviceInfo deviceInfo) throws NetconfException {
- this.deviceInfo = deviceInfo;
- this.netconfConnection = null;
- this.sshSession = null;
- connectionActive = false;
- replies = new ConcurrentHashMap<>();
- errorReplies = new ArrayList<>();
- connectTimeout = deviceInfo.getConnectTimeoutSec().orElse(
- NetconfControllerImpl.netconfConnectTimeout);
- replyTimeout = deviceInfo.getReplyTimeoutSec().orElse(
- NetconfControllerImpl.netconfReplyTimeout);
- log.info("Connecting to {} with timeouts C:{}, R:{}. idle=connect", deviceInfo,
- connectTimeout, replyTimeout);
- startConnection();
- }
-
- private void startConnection() throws NetconfException {
- if (!connectionActive) {
- netconfConnection = new Connection(deviceInfo.ip().toString(), deviceInfo.port());
-
- try {
- netconfConnection.connect(null, 1000 * connectTimeout, 1000 * connectTimeout);
- } catch (IOException e) {
- throw new NetconfException("Cannot open a connection with device " + deviceInfo, e);
- }
- boolean isAuthenticated;
- try {
- if (deviceInfo.getKeyFile() != null && deviceInfo.getKeyFile().canRead()) {
- log.debug("Authenticating with key file to device {} with username {}",
- deviceInfo.getDeviceId(), deviceInfo.name());
- isAuthenticated = netconfConnection.authenticateWithPublicKey(
- deviceInfo.name(), deviceInfo.getKeyFile(),
- deviceInfo.password().equals("") ? null : deviceInfo.password());
- } else if (deviceInfo.getKey() != null) {
- log.debug("Authenticating with key to device {} with username {}",
- deviceInfo.getDeviceId(), deviceInfo.name());
- isAuthenticated = netconfConnection.authenticateWithPublicKey(
- deviceInfo.name(), deviceInfo.getKey(),
- deviceInfo.password().equals("") ? null : deviceInfo.password());
- } else {
- log.debug("Authenticating to device {} with username {} with password",
- deviceInfo.getDeviceId(), deviceInfo.name());
- isAuthenticated = netconfConnection.authenticateWithPassword(
- deviceInfo.name(), deviceInfo.password());
- }
- } catch (IOException e) {
- log.error("Authentication connection to device {} failed",
- deviceInfo.getDeviceId(), e);
- throw new NetconfException("Authentication connection to device " +
- deviceInfo.getDeviceId() + " failed", e);
- }
-
- connectionActive = true;
- Preconditions.checkArgument(isAuthenticated,
- "Authentication to device %s with username " +
- "%s failed",
- deviceInfo.getDeviceId(), deviceInfo.name());
- startSshSession();
- }
- }
-
- private void startSshSession() throws NetconfException {
- try {
- sshSession = netconfConnection.openSession();
- sshSession.startSubSystem("netconf");
- streamHandler = new NetconfStreamThread(sshSession.getStdout(), sshSession.getStdin(),
- sshSession.getStderr(), deviceInfo,
- new NetconfSessionDelegateImpl(),
- replies);
- this.addDeviceOutputListener(new NetconfDeviceOutputEventListenerImpl(deviceInfo));
- sendHello();
- } catch (IOException e) {
- log.error("Failed to create ch.ethz.ssh2.Session session {} ", e.getMessage());
- throw new NetconfException("Failed to create ch.ethz.ssh2.Session session with device" +
- deviceInfo, e);
- }
- }
-
-
- @Beta
- private void startSubscriptionConnection(String filterSchema) throws NetconfException {
- if (!serverCapabilities.contains("interleave")) {
- throw new NetconfException("Device" + deviceInfo + "does not support interleave");
- }
- String reply = sendRequest(createSubscriptionString(filterSchema));
- if (!checkReply(reply)) {
- throw new NetconfException("Subscription not successful with device "
- + deviceInfo + " with reply " + reply);
- }
- subscriptionConnected = true;
- }
-
- @Override
- public void startSubscription() throws NetconfException {
- if (!subscriptionConnected) {
- startSubscriptionConnection(null);
- }
- streamHandler.setEnableNotifications(true);
- }
-
- @Beta
- @Override
- public void startSubscription(String filterSchema) throws NetconfException {
- if (!subscriptionConnected) {
- notificationFilterSchema = filterSchema;
- startSubscriptionConnection(filterSchema);
- }
- streamHandler.setEnableNotifications(true);
- }
-
- @Beta
- private String createSubscriptionString(String filterSchema) {
- StringBuilder subscriptionbuffer = new StringBuilder();
- subscriptionbuffer.append("<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n");
- subscriptionbuffer.append(" <create-subscription\n");
- subscriptionbuffer.append("xmlns=\"urn:ietf:params:xml:ns:netconf:notification:1.0\">\n");
- // FIXME Only subtree filtering supported at the moment.
- if (filterSchema != null) {
- subscriptionbuffer.append(" ");
- subscriptionbuffer.append(SUBSCRIPTION_SUBTREE_FILTER_OPEN).append(NEW_LINE);
- subscriptionbuffer.append(filterSchema).append(NEW_LINE);
- subscriptionbuffer.append(" ");
- subscriptionbuffer.append(SUBTREE_FILTER_CLOSE).append(NEW_LINE);
- }
- subscriptionbuffer.append(" </create-subscription>\n");
- subscriptionbuffer.append("</rpc>\n");
- subscriptionbuffer.append(ENDPATTERN);
- return subscriptionbuffer.toString();
- }
-
- @Override
- public void endSubscription() throws NetconfException {
- if (subscriptionConnected) {
- streamHandler.setEnableNotifications(false);
- } else {
- throw new NetconfException("Subscription does not exist.");
- }
- }
-
- private void sendHello() throws NetconfException {
- serverCapabilities = sendRequest(createHelloString());
- }
-
- private String createHelloString() {
- StringBuilder hellobuffer = new StringBuilder();
- hellobuffer.append(XML_HEADER);
- hellobuffer.append("\n");
- hellobuffer.append("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n");
- hellobuffer.append(" <capabilities>\n");
- deviceCapabilities.forEach(
- cap -> hellobuffer.append(" <capability>")
- .append(cap)
- .append("</capability>\n"));
- hellobuffer.append(" </capabilities>\n");
- hellobuffer.append("</hello>\n");
- hellobuffer.append(ENDPATTERN);
- return hellobuffer.toString();
-
- }
-
- @Override
- public void checkAndReestablish() throws NetconfException {
- if (sshSession.getState() != Channel.STATE_OPEN) {
- try {
- log.debug("Trying to reopen the Sesion with {}", deviceInfo.getDeviceId());
- startSshSession();
- } catch (IOException | IllegalStateException e) {
- log.debug("Trying to reopen the Connection with {}", deviceInfo.getDeviceId());
- try {
- connectionActive = false;
- replies.clear();
- messageIdInteger.set(0);
- startConnection();
- if (subscriptionConnected) {
- log.debug("Restarting subscription with {}", deviceInfo.getDeviceId());
- subscriptionConnected = false;
- startSubscription(notificationFilterSchema);
- }
- } catch (IOException e2) {
- log.error("No connection {} for device {}", netconfConnection, e.getMessage());
- throw new NetconfException("Cannot re-open the connection with device" + deviceInfo, e);
- }
- }
- }
- }
-
- @Override
- public String requestSync(String request) throws NetconfException {
- if (!request.contains(ENDPATTERN)) {
- request = request + NEW_LINE + ENDPATTERN;
- }
- String reply = sendRequest(request);
- checkReply(reply);
- return reply;
- }
-
- @Override
- @Deprecated
- public CompletableFuture<String> request(String request) {
- return streamHandler.sendMessage(request);
- }
-
- private CompletableFuture<String> request(String request, int messageId) {
- return streamHandler.sendMessage(request, messageId);
- }
-
- private String sendRequest(String request) throws NetconfException {
- checkAndReestablish();
- final int messageId = messageIdInteger.getAndIncrement();
- request = formatRequestMessageId(request, messageId);
- request = formatXmlHeader(request);
- CompletableFuture<String> futureReply = request(request, messageId);
- String rp;
- try {
- rp = futureReply.get(replyTimeout, TimeUnit.SECONDS);
- replies.remove(messageId);
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
- throw new NetconfException("No matching reply for request " + request, e);
- }
- log.debug("Result {} from request {} to device {}", rp, request, deviceInfo);
- return rp.trim();
- }
-
- private String formatRequestMessageId(String request, int messageId) {
- if (request.contains(MESSAGE_ID_STRING)) {
- //FIXME if application provides his own counting of messages this fails that count
- request = request.replaceFirst(MESSAGE_ID_STRING + EQUAL + NUMBER_BETWEEN_QUOTES_MATCHER,
- MESSAGE_ID_STRING + EQUAL + "\"" + messageId + "\"");
- } else if (!request.contains(MESSAGE_ID_STRING) && !request.contains(HELLO)) {
- //FIXME find out a better way to enforce the presence of message-id
- request = request.replaceFirst(END_OF_RPC_OPEN_TAG, "\" " + MESSAGE_ID_STRING + EQUAL + "\""
- + messageId + "\"" + ">");
- }
- return request;
- }
-
- private String formatXmlHeader(String request) {
- if (!request.contains(XML_HEADER)) {
- //FIXME if application provieds his own XML header of different type there is a clash
- request = XML_HEADER + "\n" + request;
- }
- return request;
- }
-
- @Override
- public String doWrappedRpc(String request) throws NetconfException {
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append(RPC_OPEN);
- rpc.append(MESSAGE_ID_STRING);
- rpc.append(EQUAL);
- rpc.append("\"");
- rpc.append(messageIdInteger.get());
- rpc.append("\" ");
- rpc.append(NETCONF_BASE_NAMESPACE).append(">\n");
- rpc.append(request);
- rpc.append(RPC_CLOSE).append(NEW_LINE);
- rpc.append(ENDPATTERN);
- String reply = sendRequest(rpc.toString());
- checkReply(reply);
- return reply;
- }
-
- @Override
- public String get(String request) throws NetconfException {
- return requestSync(request);
- }
-
- @Override
- public String get(String filterSchema, String withDefaultsMode) throws NetconfException {
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append(RPC_OPEN);
- rpc.append(MESSAGE_ID_STRING);
- rpc.append(EQUAL);
- rpc.append("\"");
- rpc.append(messageIdInteger.get());
- rpc.append("\" ");
- rpc.append(NETCONF_BASE_NAMESPACE).append(">\n");
- rpc.append(GET_OPEN).append(NEW_LINE);
- if (filterSchema != null) {
- rpc.append(SUBTREE_FILTER_OPEN).append(NEW_LINE);
- rpc.append(filterSchema).append(NEW_LINE);
- rpc.append(SUBTREE_FILTER_CLOSE).append(NEW_LINE);
- }
- if (withDefaultsMode != null) {
- rpc.append(WITH_DEFAULT_OPEN).append(NETCONF_WITH_DEFAULTS_NAMESPACE).append(">");
- rpc.append(withDefaultsMode).append(WITH_DEFAULT_CLOSE).append(NEW_LINE);
- }
- rpc.append(GET_CLOSE).append(NEW_LINE);
- rpc.append(RPC_CLOSE).append(NEW_LINE);
- rpc.append(ENDPATTERN);
- String reply = sendRequest(rpc.toString());
- checkReply(reply);
- return reply;
- }
-
- @Override
- public String getConfig(TargetConfig netconfTargetConfig) throws NetconfException {
- return getConfig(netconfTargetConfig, null);
- }
-
- @Override
- public String getConfig(String netconfTargetConfig) throws NetconfException {
- return getConfig(TargetConfig.toTargetConfig(netconfTargetConfig));
- }
-
- @Override
- public String getConfig(String netconfTargetConfig, String configurationFilterSchema) throws NetconfException {
- return getConfig(TargetConfig.toTargetConfig(netconfTargetConfig), configurationFilterSchema);
- }
-
- @Override
- public String getConfig(TargetConfig netconfTargetConfig, String configurationSchema) throws NetconfException {
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append("<rpc ");
- rpc.append(MESSAGE_ID_STRING);
- rpc.append(EQUAL);
- rpc.append("\"");
- rpc.append(messageIdInteger.get());
- rpc.append("\" ");
- rpc.append("xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n");
- rpc.append("<get-config>\n");
- rpc.append("<source>\n");
- rpc.append("<").append(netconfTargetConfig).append("/>");
- rpc.append("</source>");
- if (configurationSchema != null) {
- rpc.append("<filter type=\"subtree\">\n");
- rpc.append(configurationSchema).append("\n");
- rpc.append("</filter>\n");
- }
- rpc.append("</get-config>\n");
- rpc.append("</rpc>\n");
- rpc.append(ENDPATTERN);
- String reply = sendRequest(rpc.toString());
- return checkReply(reply) ? reply : "ERROR " + reply;
- }
-
- @Override
- public boolean editConfig(String newConfiguration) throws NetconfException {
- newConfiguration = newConfiguration + ENDPATTERN;
- return checkReply(sendRequest(newConfiguration));
- }
-
- @Override
- public boolean editConfig(String netconfTargetConfig, String mode, String newConfiguration)
- throws NetconfException {
- return editConfig(TargetConfig.toTargetConfig(netconfTargetConfig), mode, newConfiguration);
- }
-
- @Override
- public boolean editConfig(TargetConfig netconfTargetConfig, String mode, String newConfiguration)
- throws NetconfException {
- newConfiguration = newConfiguration.trim();
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append(RPC_OPEN);
- rpc.append(MESSAGE_ID_STRING);
- rpc.append(EQUAL);
- rpc.append("\"");
- rpc.append(messageIdInteger.get());
- rpc.append("\" ");
- rpc.append(NETCONF_BASE_NAMESPACE).append(">\n");
- rpc.append(EDIT_CONFIG_OPEN).append("\n");
- rpc.append(TARGET_OPEN);
- rpc.append("<").append(netconfTargetConfig).append("/>");
- rpc.append(TARGET_CLOSE).append("\n");
- if (mode != null) {
- rpc.append(DEFAULT_OPERATION_OPEN);
- rpc.append(mode);
- rpc.append(DEFAULT_OPERATION_CLOSE).append("\n");
- }
- rpc.append(CONFIG_OPEN).append("\n");
- rpc.append(newConfiguration);
- rpc.append(CONFIG_CLOSE).append("\n");
- rpc.append(EDIT_CONFIG_CLOSE).append("\n");
- rpc.append(RPC_CLOSE);
- rpc.append(ENDPATTERN);
- log.debug(rpc.toString());
- String reply = sendRequest(rpc.toString());
- return checkReply(reply);
- }
-
- @Override
- public boolean copyConfig(String netconfTargetConfig, String newConfiguration) throws NetconfException {
- return copyConfig(TargetConfig.toTargetConfig(netconfTargetConfig), newConfiguration);
- }
-
- @Override
- public boolean copyConfig(TargetConfig netconfTargetConfig, String newConfiguration)
- throws NetconfException {
- newConfiguration = newConfiguration.trim();
- if (!newConfiguration.startsWith("<config>")) {
- newConfiguration = "<config>" + newConfiguration
- + "</config>";
- }
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append(RPC_OPEN);
- rpc.append(NETCONF_BASE_NAMESPACE).append(">\n");
- rpc.append("<copy-config>");
- rpc.append("<target>");
- rpc.append("<").append(netconfTargetConfig).append("/>");
- rpc.append("</target>");
- rpc.append("<source>");
- rpc.append(newConfiguration);
- rpc.append("</source>");
- rpc.append("</copy-config>");
- rpc.append("</rpc>");
- rpc.append(ENDPATTERN);
- return checkReply(sendRequest(rpc.toString()));
- }
-
- @Override
- public boolean deleteConfig(String netconfTargetConfig) throws NetconfException {
- return deleteConfig(TargetConfig.toTargetConfig(netconfTargetConfig));
- }
-
- @Override
- public boolean deleteConfig(TargetConfig netconfTargetConfig) throws NetconfException {
- if (netconfTargetConfig.equals(TargetConfig.RUNNING)) {
- log.warn("Target configuration for delete operation can't be \"running\"",
- netconfTargetConfig);
- return false;
- }
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append("<rpc>");
- rpc.append("<delete-config>");
- rpc.append("<target>");
- rpc.append("<").append(netconfTargetConfig).append("/>");
- rpc.append("</target>");
- rpc.append("</delete-config>");
- rpc.append("</rpc>");
- rpc.append(ENDPATTERN);
- return checkReply(sendRequest(rpc.toString()));
- }
-
- @Override
- public boolean lock(String configType) throws NetconfException {
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append("<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n");
- rpc.append("<lock>");
- rpc.append("<target>");
- rpc.append("<");
- rpc.append(configType);
- rpc.append("/>");
- rpc.append("</target>");
- rpc.append("</lock>");
- rpc.append("</rpc>");
- rpc.append(ENDPATTERN);
- String lockReply = sendRequest(rpc.toString());
- return checkReply(lockReply);
- }
-
- @Override
- public boolean unlock(String configType) throws NetconfException {
- StringBuilder rpc = new StringBuilder(XML_HEADER);
- rpc.append("<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n");
- rpc.append("<unlock>");
- rpc.append("<target>");
- rpc.append("<");
- rpc.append(configType);
- rpc.append("/>");
- rpc.append("</target>");
- rpc.append("</unlock>");
- rpc.append("</rpc>");
- rpc.append(ENDPATTERN);
- String unlockReply = sendRequest(rpc.toString());
- return checkReply(unlockReply);
- }
-
- @Override
- public boolean lock() throws NetconfException {
- return lock("running");
- }
-
- @Override
- public boolean unlock() throws NetconfException {
- return unlock("running");
- }
-
- @Override
- public boolean close() throws NetconfException {
- return close(false);
- }
-
- private boolean close(boolean force) throws NetconfException {
- StringBuilder rpc = new StringBuilder();
- rpc.append("<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">");
- if (force) {
- rpc.append("<kill-session/>");
- } else {
- rpc.append("<close-session/>");
- }
- rpc.append("</rpc>");
- rpc.append(ENDPATTERN);
- return checkReply(sendRequest(rpc.toString())) || close(true);
- }
-
- @Override
- public String getSessionId() {
- if (serverCapabilities.contains("<session-id>")) {
- String[] outer = serverCapabilities.split("<session-id>");
- Preconditions.checkArgument(outer.length != 1,
- "Error in retrieving the session id");
- String[] value = outer[1].split("</session-id>");
- Preconditions.checkArgument(value.length != 1,
- "Error in retrieving the session id");
- return value[0];
- } else {
- return String.valueOf(-1);
- }
- }
-
- @Override
- public String getServerCapabilities() {
- return serverCapabilities;
- }
-
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- deviceCapabilities = capabilities;
- }
-
- @Override
- public int timeoutConnectSec() {
- return connectTimeout;
- }
-
- @Override
- public int timeoutReplySec() {
- return replyTimeout;
- }
-
- /**
- * Idle timeout is not settable on ETZ_SSH - the valuse used is the connect timeout.
- */
- @Override
- public int timeoutIdleSec() {
- return connectTimeout;
- }
-
- @Override
- public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) {
- streamHandler.addDeviceEventListener(listener);
- }
-
- @Override
- public void removeDeviceOutputListener(NetconfDeviceOutputEventListener listener) {
- streamHandler.removeDeviceEventListener(listener);
- }
-
- private boolean checkReply(String reply) throws NetconfException {
- if (reply != null) {
- if (!reply.contains("<rpc-error>")) {
- log.debug("Device {} sent reply {}", deviceInfo, reply);
- return true;
- } else if (reply.contains("<ok/>")
- || (reply.contains("<rpc-error>")
- && reply.contains("warning"))) {
- log.debug("Device {} sent reply {}", deviceInfo, reply);
- return true;
- }
- }
- log.warn("Device {} has error in reply {}", deviceInfo, reply);
- return false;
- }
-
- public class NetconfSessionDelegateImpl implements NetconfSessionDelegate {
-
- @Override
- public void notify(NetconfDeviceOutputEvent event) {
- Optional<Integer> messageId = event.getMessageID();
- log.debug("messageID {}, waiting replies messageIDs {}", messageId,
- replies.keySet());
- if (!messageId.isPresent()) {
- errorReplies.add(event.getMessagePayload());
- log.error("Device {} sent error reply {}",
- event.getDeviceInfo(), event.getMessagePayload());
- return;
- }
- CompletableFuture<String> completedReply =
- replies.get(messageId.get());
- if (completedReply != null) {
- completedReply.complete(event.getMessagePayload());
- }
- }
- }
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamHandler.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamHandler.java
deleted file mode 100644
index a0bdd90..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.netconf.NetconfDeviceOutputEventListener;
-
-import java.util.concurrent.CompletableFuture;
-
-/**
- * Interface to represent an objects that does all the IO on a NETCONF session
- * with a device.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-public interface NetconfStreamHandler {
- /**
- * Sends the request on the stream that is used to communicate to and from the device.
- *
- * If this request does not contain a messageId then this will throw a NoSuchElementException
- *
- * @param request request to send to the physical device
- * @return a CompletableFuture of type String that will contain the response for the request.
- * @deprecated - use method with messageId parameter instead
- */
- @Deprecated
- CompletableFuture<String> sendMessage(String request);
-
- /**
- * Sends the request on the stream that is used to communicate to and from the device.
- *
- * @param request request to send to the physical device
- * @param messageId The identifier of the message - should be unique for the session
- * @return a CompletableFuture of type String that will contain the response for the request.
- */
- CompletableFuture<String> sendMessage(String request, int messageId);
-
- /**
- * Adds a listener for netconf events on the handled stream.
- *
- * @param listener Netconf device event listener
- */
- void addDeviceEventListener(NetconfDeviceOutputEventListener listener);
-
- /**
- * Removes a listener for netconf events on the handled stream.
- *
- * @param listener Netconf device event listener
- */
- void removeDeviceEventListener(NetconfDeviceOutputEventListener listener);
-
- @Beta
- /**
- * Sets instance variable that when true allows receipt of notifications.
- *
- * @param enableNotifications if true, allows action based off notifications
- * else, stops action based off notifications
- */
- void setEnableNotifications(boolean enableNotifications);
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
deleted file mode 100644
index 4bb15c4..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfStreamThread.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.netconf.ctl;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import org.onosproject.netconf.NetconfDeviceInfo;
-import org.onosproject.netconf.NetconfDeviceOutputEvent;
-import org.onosproject.netconf.NetconfDeviceOutputEventListener;
-import org.onosproject.netconf.NetconfException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Thread that gets spawned each time a session is established and handles all the input
- * and output from the session's streams to and from the NETCONF device the session is
- * established with.
- *
- * @deprecated in 1.10.0
- */
-@Deprecated
-public class NetconfStreamThread extends Thread implements NetconfStreamHandler {
-
- private static final Logger log = LoggerFactory
- .getLogger(NetconfStreamThread.class);
- private static final String HELLO = "<hello";
- private static final String END_PATTERN = "]]>]]>";
- private static final String RPC_REPLY = "rpc-reply";
- private static final String RPC_ERROR = "rpc-error";
- private static final String NOTIFICATION_LABEL = "<notification";
- private static final String MESSAGE_ID = "message-id=";
- private static final Pattern MSGID_PATTERN = Pattern.compile(MESSAGE_ID + "\"(\\d+)\"");
-
- private PrintWriter outputStream;
- private final InputStream err;
- private final InputStream in;
- private NetconfDeviceInfo netconfDeviceInfo;
- private NetconfSessionDelegate sessionDelegate;
- private NetconfMessageState state;
- private List<NetconfDeviceOutputEventListener> netconfDeviceEventListeners
- = Lists.newCopyOnWriteArrayList();
- private boolean enableNotifications = true;
- private Map<Integer, CompletableFuture<String>> replies;
-
- public NetconfStreamThread(final InputStream in, final OutputStream out,
- final InputStream err, NetconfDeviceInfo deviceInfo,
- NetconfSessionDelegate delegate,
- Map<Integer, CompletableFuture<String>> replies) {
- this.in = in;
- this.err = err;
- outputStream = new PrintWriter(out);
- netconfDeviceInfo = deviceInfo;
- state = NetconfMessageState.NO_MATCHING_PATTERN;
- sessionDelegate = delegate;
- this.replies = replies;
- log.debug("Stream thread for device {} session started", deviceInfo);
- start();
- }
-
- @Override
- public CompletableFuture<String> sendMessage(String request) {
- Optional<Integer> messageId = getMsgId(request);
- return sendMessage(request, messageId.get());
- }
-
- @Override
- public CompletableFuture<String> sendMessage(String request, int messageId) {
- log.debug("Sending message {} to device {}", request, netconfDeviceInfo);
- CompletableFuture<String> cf = new CompletableFuture<>();
- replies.put(messageId, cf);
-
- synchronized (outputStream) {
- outputStream.print(request);
- outputStream.flush();
- }
-
- return cf;
- }
-
- public enum NetconfMessageState {
-
- NO_MATCHING_PATTERN {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == ']') {
- return FIRST_BRACKET;
- } else {
- return this;
- }
- }
- },
- FIRST_BRACKET {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == ']') {
- return SECOND_BRACKET;
- } else {
- return NO_MATCHING_PATTERN;
- }
- }
- },
- SECOND_BRACKET {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == '>') {
- return FIRST_BIGGER;
- } else {
- return NO_MATCHING_PATTERN;
- }
- }
- },
- FIRST_BIGGER {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == ']') {
- return THIRD_BRACKET;
- } else {
- return NO_MATCHING_PATTERN;
- }
- }
- },
- THIRD_BRACKET {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == ']') {
- return ENDING_BIGGER;
- } else {
- return NO_MATCHING_PATTERN;
- }
- }
- },
- ENDING_BIGGER {
- @Override
- NetconfMessageState evaluateChar(char c) {
- if (c == '>') {
- return END_PATTERN;
- } else {
- return NO_MATCHING_PATTERN;
- }
- }
- },
- END_PATTERN {
- @Override
- NetconfMessageState evaluateChar(char c) {
- return NO_MATCHING_PATTERN;
- }
- };
-
- abstract NetconfMessageState evaluateChar(char c);
- }
-
- @Override
- public void run() {
- BufferedReader bufferReader = new BufferedReader(new InputStreamReader(in));
- try {
- boolean socketClosed = false;
- StringBuilder deviceReplyBuilder = new StringBuilder();
- while (!socketClosed) {
- int cInt = bufferReader.read();
- if (cInt == -1) {
- log.debug("Netconf device {} sent error char in session," +
- " will need to be reopend", netconfDeviceInfo);
- NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
- NetconfDeviceOutputEvent.Type.SESSION_CLOSED,
- null, null, Optional.of(-1), netconfDeviceInfo);
- netconfDeviceEventListeners.forEach(
- listener -> listener.event(event));
- socketClosed = true;
- log.debug("Netconf device {} ERROR cInt == -1 socketClosed = true", netconfDeviceInfo);
- }
- char c = (char) cInt;
- state = state.evaluateChar(c);
- deviceReplyBuilder.append(c);
- if (state == NetconfMessageState.END_PATTERN) {
- String deviceReply = deviceReplyBuilder.toString();
- if (deviceReply.equals(END_PATTERN)) {
- socketClosed = true;
- log.debug("Netconf device {} socketClosed = true DEVICE_UNREGISTERED {}",
- netconfDeviceInfo, deviceReply);
- NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
- NetconfDeviceOutputEvent.Type.DEVICE_UNREGISTERED,
- null, null, Optional.of(-1), netconfDeviceInfo);
- netconfDeviceEventListeners.forEach(
- listener -> listener.event(event));
- this.interrupt();
- } else {
- deviceReply = deviceReply.replace(END_PATTERN, "");
- if (deviceReply.contains(RPC_REPLY) ||
- deviceReply.contains(RPC_ERROR) ||
- deviceReply.contains(HELLO)) {
- log.debug("Netconf device {} sessionDelegate.notify() DEVICE_REPLY {} {}",
- netconfDeviceInfo, getMsgId(deviceReply), deviceReply);
- NetconfDeviceOutputEvent event = new NetconfDeviceOutputEvent(
- NetconfDeviceOutputEvent.Type.DEVICE_REPLY,
- null, deviceReply, getMsgId(deviceReply), netconfDeviceInfo);
- sessionDelegate.notify(event);
- netconfDeviceEventListeners.forEach(
- listener -> listener.event(event));
- } else if (deviceReply.contains(NOTIFICATION_LABEL)) {
- log.debug("Netconf device {} DEVICE_NOTIFICATION {} {} {}",
- netconfDeviceInfo, enableNotifications,
- getMsgId(deviceReply), deviceReply);
- if (enableNotifications) {
- log.debug("dispatching to {} listeners", netconfDeviceEventListeners.size());
- final String finalDeviceReply = deviceReply;
- netconfDeviceEventListeners.forEach(
- listener -> listener.event(new NetconfDeviceOutputEvent(
- NetconfDeviceOutputEvent.Type.DEVICE_NOTIFICATION,
- null, finalDeviceReply, getMsgId(finalDeviceReply),
- netconfDeviceInfo)));
- }
- } else {
- log.debug("Error on reply from device {} {}", netconfDeviceInfo, deviceReply);
- }
- deviceReplyBuilder.setLength(0);
- }
- }
- }
- } catch (IOException e) {
- log.warn("Error in reading from the session for device {} ", netconfDeviceInfo, e);
- throw new RuntimeException(new NetconfException("Error in reading from the session for device {}" +
- netconfDeviceInfo, e));
- //TODO should we send a socket closed message to listeners ?
- }
- }
-
- protected static Optional<Integer> getMsgId(String reply) {
- Matcher matcher = MSGID_PATTERN.matcher(reply);
- if (matcher.find()) {
- Integer messageId = Integer.parseInt(matcher.group(1));
- Preconditions.checkNotNull(messageId, "Error in retrieving the message id");
- return Optional.of(messageId);
- }
- if (reply.contains(HELLO)) {
- return Optional.of(0);
- }
- return Optional.empty();
- }
-
- @Override
- public void addDeviceEventListener(NetconfDeviceOutputEventListener listener) {
- if (!netconfDeviceEventListeners.contains(listener)) {
- netconfDeviceEventListeners.add(listener);
- }
- }
-
- @Override
- public void removeDeviceEventListener(NetconfDeviceOutputEventListener listener) {
- netconfDeviceEventListeners.remove(listener);
- }
-
- @Override
- public void setEnableNotifications(boolean enableNotifications) {
- this.enableNotifications = enableNotifications;
- }
-}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
index daba5be..a1797d7 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
@@ -24,6 +24,7 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.onlab.packet.IpAddress;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.net.AnnotationKeys;
@@ -49,6 +50,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.security.Security;
import java.util.Arrays;
import java.util.Dictionary;
import java.util.Map;
@@ -128,6 +130,7 @@
public void activate(ComponentContext context) {
cfgService.registerProperties(getClass());
modified(context);
+ Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
log.info("Started");
}
@@ -140,6 +143,7 @@
cfgService.unregisterProperties(getClass(), false);
netconfDeviceListeners.clear();
netconfDeviceMap.clear();
+ Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
log.info("Stopped");
}
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
index 28c3358..48727a2 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionImpl.java
@@ -781,18 +781,6 @@
return Collections.unmodifiableSet(deviceCapabilities);
}
- @Deprecated
- @Override
- public String getServerCapabilities() {
- return serverHelloResponseOld;
- }
-
- @Deprecated
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- onosCapabilities = capabilities;
- }
-
@Override
public void setOnosCapabilities(Iterable<String> capabilities) {
onosCapabilities = capabilities;
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
index abdd377..c8a4604 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImpl.java
@@ -28,6 +28,10 @@
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openssl.PEMParser;
+import org.bouncycastle.openssl.PEMKeyPair;
+import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.onosproject.netconf.DatastoreId;
import org.onosproject.netconf.NetconfDeviceInfo;
import org.onosproject.netconf.NetconfDeviceOutputEvent;
@@ -39,12 +43,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import static java.nio.charset.StandardCharsets.UTF_8;
+import java.io.CharArrayReader;
import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.StandardCharsets;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.NoSuchAlgorithmException;
@@ -208,23 +211,16 @@
session = connectFuture.getSession();
//Using the device ssh key if possible
if (deviceInfo.getKey() != null) {
- ByteBuffer buf = StandardCharsets.UTF_8.encode(CharBuffer.wrap(deviceInfo.getKey()));
- byte[] byteKey = new byte[buf.limit()];
- buf.get(byteKey);
- PublicKey key;
- try {
- key = getPublicKey(byteKey, RSA);
- } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
+ try (PEMParser pemParser = new PEMParser(new CharArrayReader(deviceInfo.getKey()))) {
+ JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME);
try {
- key = getPublicKey(byteKey, DSA);
- } catch (NoSuchAlgorithmException | InvalidKeySpecException e1) {
+ KeyPair kp = converter.getKeyPair((PEMKeyPair) pemParser.readObject());
+ session.addPublicKeyIdentity(kp);
+ } catch (IOException e) {
throw new NetconfException("Failed to authenticate session with device " +
- deviceInfo + "check key to be the " +
- "proper DSA or RSA key", e1);
+ deviceInfo + "check key to be a valid key", e);
}
}
- //privateKye can set tu null because is not used by the method.
- session.addPublicKeyIdentity(new KeyPair(key, null));
} else {
session.addPasswordIdentity(deviceInfo.password());
}
@@ -452,9 +448,11 @@
*/
private String formatChunkedMessage(String message) {
if (message.endsWith(ENDPATTERN)) {
+ // message given had Netconf 1.0 EOM pattern -> remove
message = message.substring(0, message.length() - ENDPATTERN.length());
}
if (!message.startsWith(LF + HASH)) {
+ // chunk encode message
message = LF + HASH + message.getBytes(UTF_8).length + LF + message + LF + HASH + HASH + LF;
}
return message;
@@ -487,6 +485,7 @@
}
private String sendRequest(String request) throws NetconfException {
+ // FIXME probably chunk-encoding too early
request = formatNetconfMessage(request);
return sendRequest(request, false);
}
@@ -497,6 +496,7 @@
if (!isHello) {
messageId = messageIdInteger.getAndIncrement();
}
+ // FIXME potentially re-writing chunked encoded String?
request = formatXmlHeader(request);
request = formatRequestMessageId(request, messageId);
CompletableFuture<String> futureReply = request(request, messageId);
@@ -846,18 +846,6 @@
return Collections.unmodifiableSet(deviceCapabilities);
}
- @Deprecated
- @Override
- public String getServerCapabilities() {
- return serverHelloResponseOld;
- }
-
- @Deprecated
- @Override
- public void setDeviceCapabilities(List<String> capabilities) {
- onosCapabilities = capabilities;
- }
-
@Override
public void setOnosCapabilities(Iterable<String> capabilities) {
onosCapabilities = capabilities;
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/package-info.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/package-info.java
deleted file mode 100644
index bcd68a8..0000000
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2015-present Open Networking Foundation
- *
- * 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.
- */
-
-/**
- * NETCONF controller implementations.
- */
-@java.lang.Deprecated
-package org.onosproject.netconf.ctl;
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
index 8fd4a86..7e78b80 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionMinaImplTest.java
@@ -195,7 +195,7 @@
assertNotNull("Incorrect sessionId", session1.getSessionId());
try {
assertTrue("NETCONF edit-config command failed",
- session1.editConfig(RUNNING.toString(),
+ session1.editConfig(RUNNING,
null, SAMPLE_REQUEST));
} catch (NetconfException e) {
e.printStackTrace();
@@ -211,7 +211,7 @@
assertNotNull("Incorrect sessionId", session3.getSessionId());
try {
assertTrue("NETCONF edit-config command failed",
- session3.editConfig(RUNNING.toString(),
+ session3.editConfig(RUNNING,
null, SAMPLE_REQUEST));
} catch (NetconfException e) {
e.printStackTrace();
diff --git a/protocols/netconf/pom.xml b/protocols/netconf/pom.xml
index e27ee31..9cf595d 100644
--- a/protocols/netconf/pom.xml
+++ b/protocols/netconf/pom.xml
@@ -24,7 +24,7 @@
<version>1.12.0-SNAPSHOT</version>
</parent>
- <artifactId>onos-netconf</artifactId>
+ <artifactId>onos-protocols-netconf</artifactId>
<packaging>pom</packaging>
<modules>
diff --git a/providers/netconf/alarm/pom.xml b/providers/netconf/alarm/pom.xml
index 8187ec3..931f5a9 100644
--- a/providers/netconf/alarm/pom.xml
+++ b/providers/netconf/alarm/pom.xml
@@ -22,12 +22,12 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-ctl</artifactId>
+ <artifactId>onos-protocols-netconf-ctl</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git a/providers/netconf/app/app.xml b/providers/netconf/app/app.xml
index 01dbb42..00ce4ff 100644
--- a/providers/netconf/app/app.xml
+++ b/providers/netconf/app/app.xml
@@ -20,8 +20,8 @@
apps="org.onosproject.faultmanagement"
features="${project.artifactId}">
<description>${project.description}</description>
- <artifact>mvn:${project.groupId}/onos-netconf-api/${project.version}</artifact>
- <artifact>mvn:${project.groupId}/onos-netconf-ctl/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</artifact>
+ <artifact>mvn:${project.groupId}/onos-protocols-netconf-ctl/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-netconf-provider-device/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-netconf-provider-alarm/${project.version}</artifact>
diff --git a/providers/netconf/app/features.xml b/providers/netconf/app/features.xml
index c8b6fa1..84d0c3b 100644
--- a/providers/netconf/app/features.xml
+++ b/providers/netconf/app/features.xml
@@ -19,8 +19,8 @@
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-api/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-netconf-ctl/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/onos-protocols-netconf-ctl/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-netconf-provider-device/${project.version}</bundle>
<bundle>mvn:${project.groupId}/onos-netconf-provider-alarm/${project.version}</bundle>
diff --git a/providers/netconf/device/pom.xml b/providers/netconf/device/pom.xml
index 7860785..57cfaa1 100644
--- a/providers/netconf/device/pom.xml
+++ b/providers/netconf/device/pom.xml
@@ -38,12 +38,12 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-api</artifactId>
+ <artifactId>onos-protocols-netconf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
- <artifactId>onos-netconf-ctl</artifactId>
+ <artifactId>onos-protocols-netconf-ctl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/utils/misc/src/main/java/org/onlab/packet/MacAddress.java b/utils/misc/src/main/java/org/onlab/packet/MacAddress.java
index e41fb05..b048794 100644
--- a/utils/misc/src/main/java/org/onlab/packet/MacAddress.java
+++ b/utils/misc/src/main/java/org/onlab/packet/MacAddress.java
@@ -56,6 +56,14 @@
*/
public static final MacAddress IPV4_MULTICAST_MASK = valueOf("ff:ff:ff:80:00:00");
/**
+ * IPv6 multicast MAC address.
+ */
+ public static final MacAddress IPV6_MULTICAST = valueOf("33:33:00:00:00:00");
+ /**
+ * IPv6 multicast MAC mask.
+ */
+ public static final MacAddress IPV6_MULTICAST_MASK = valueOf("FF:FF:00:00:00:00");
+ /**
* A set of LLDP MAC addresses.
*/
public static final Set<MacAddress> LLDP = ImmutableSet.of(
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Host.js b/web/gui/src/main/webapp/app/view/topo2/topo2Host.js
index a2f2124..bd04c7b 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Host.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Host.js
@@ -49,7 +49,8 @@
.factory('Topo2HostService', [
'Topo2Collection', 'Topo2NodeModel', 'Topo2ViewService',
'IconService', 'Topo2ZoomService', 'Topo2HostsPanelService', 'PrefsService',
- function (_c_, NodeModel, _t2vs_, is, zs, t2hds, ps) {
+ 'Topo2PrefsService',
+ function (_c_, NodeModel, _t2vs_, is, zs, t2hds, ps, t2ps) {
Collection = _c_;
@@ -76,8 +77,18 @@
var type = this.get('type');
return remappedDeviceTypes[type] || type || 'm_endstation';
},
+ labelIndex: function () {
+ return t2ps.get('hlbls');
+ },
label: function () {
- return this.get('ips')[0] || 'unknown';
+ var props = this.get('props'),
+ id = this.get('ips')[0] || 'unknown',
+ friendlyName = props && props.name ? props.name : id,
+ labels = ['', friendlyName || id, id, this.get('id')],
+ nli = this.labelIndex(),
+ idx = (nli < labels.length) ? nli : 0;
+
+ return labels[idx];
},
setScale: function () {
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
index a3b75f5..b396f30 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
@@ -35,6 +35,7 @@
H: [toggleHosts, 'Toggle host visibility'],
M: [toggleOfflineDevices, 'Toggle offline visibility'],
dot: [toggleToolbar, 'Toggle Toolbar'],
+ 'shift-L': [cycleHostLabels, 'Cycle host labels'],
esc: handleEscape,
@@ -114,6 +115,15 @@
}
}
+ function hostLabelFlashMessage(index) {
+ switch (index) {
+ case 0: return 'Hide host labels';
+ case 1: return 'Show friendly host labels';
+ case 2: return 'Show host IP labels';
+ case 3: return 'Show host MAC Address labels';
+ }
+ }
+
function cycleDeviceLabels() {
var deviceLabelIndex = t2ps.get('dlbls') + 1,
newDeviceLabelIndex = deviceLabelIndex % 3;
@@ -123,6 +133,15 @@
flash.flash(deviceLabelFlashMessage(newDeviceLabelIndex));
}
+ function cycleHostLabels() {
+ var hostLabelIndex = t2ps.get('hlbls') + 1,
+ newHostLabelIndex = hostLabelIndex % 4;
+
+ t2ps.set('hlbls', newHostLabelIndex);
+ t2fs.updateNodes();
+ flash.flash(hostLabelFlashMessage(newHostLabelIndex));
+ }
+
function toggleBackground(x) {
t2bgs.toggle(x);
}