Marc De Leenheer
Committed by Gerrit Code Review

SNMP based device and flow rule provider for Lumentum SDN ROADMs.

ONOS-3690 and ONOS-3842

Change-Id: If00ba70fa26e01924c225596c52a5ffb24987cc2
Showing 24 changed files with 775 additions and 49 deletions
...@@ -29,7 +29,7 @@ public interface ConfigGetter extends HandlerBehaviour { ...@@ -29,7 +29,7 @@ public interface ConfigGetter extends HandlerBehaviour {
29 29
30 /** 30 /**
31 * Returns the string representation of a device configuration, returns a 31 * Returns the string representation of a device configuration, returns a
32 - * failure string if the configuration cannot be retreived. 32 + * failure string if the configuration cannot be retrieved.
33 * @param type the type of configuration to get (i.e. running). 33 * @param type the type of configuration to get (i.e. running).
34 * @return string representation of the configuration or an error string. 34 * @return string representation of the configuration or an error string.
35 */ 35 */
......
1 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 +<!--
3 + ~ Copyright 2016 Open Networking Laboratory
4 + ~
5 + ~ Licensed under the Apache License, Version 2.0 (the "License");
6 + ~ you may not use this file except in compliance with the License.
7 + ~ You may obtain a copy of the License at
8 + ~
9 + ~ http://www.apache.org/licenses/LICENSE-2.0
10 + ~
11 + ~ Unless required by applicable law or agreed to in writing, software
12 + ~ distributed under the License is distributed on an "AS IS" BASIS,
13 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + ~ See the License for the specific language governing permissions and
15 + ~ limitations under the License.
16 + -->
17 +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
18 + <feature name="${project.artifactId}" version="${project.version}"
19 + description="${project.description}">
20 + <feature>onos-api</feature>
21 + <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
22 +
23 + <bundle>mvn:${project.groupId}/onos-restsb-api/${project.version}</bundle>
24 +
25 + <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j/2.3.4_1</bundle>
26 +
27 + </feature>
28 +</features>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!--
3 + ~ Copyright 2016 Open Networking Laboratory
4 + ~
5 + ~ Licensed under the Apache License, Version 2.0 (the "License");
6 + ~ you may not use this file except in compliance with the License.
7 + ~ You may obtain a copy of the License at
8 + ~
9 + ~ http://www.apache.org/licenses/LICENSE-2.0
10 + ~
11 + ~ Unless required by applicable law or agreed to in writing, software
12 + ~ distributed under the License is distributed on an "AS IS" BASIS,
13 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + ~ See the License for the specific language governing permissions and
15 + ~ limitations under the License.
16 + -->
17 +<project xmlns="http://maven.apache.org/POM/4.0.0"
18 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20 + <parent>
21 + <artifactId>onos-drivers-general</artifactId>
22 + <groupId>org.onosproject</groupId>
23 + <version>1.5.0-SNAPSHOT</version>
24 + </parent>
25 + <modelVersion>4.0.0</modelVersion>
26 +
27 + <artifactId>onos-drivers-lumentum</artifactId>
28 + <packaging>bundle</packaging>
29 +
30 + <description>Lumentum device drivers</description>
31 +
32 + <properties>
33 + <onos.app.name>org.onosproject.drivers.lumentum</onos.app.name>
34 + </properties>
35 +
36 + <dependencies>
37 + <dependency>
38 + <groupId>org.apache.servicemix.bundles</groupId>
39 + <artifactId>org.apache.servicemix.bundles.snmp4j</artifactId>
40 + <version>2.3.4_1</version>
41 + </dependency>
42 + </dependencies>
43 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import org.onosproject.net.OchSignal;
19 +import org.onosproject.net.PortNumber;
20 +import org.onosproject.net.flow.FlowRule;
21 +
22 +/**
23 + * Interface for cross connects as common in optical networking.
24 + */
25 +public interface CrossConnect extends FlowRule {
26 + /**
27 + * Returns the add/drop port of the cross connect.
28 + *
29 + * @return port number
30 + */
31 + PortNumber addDrop();
32 +
33 + /**
34 + * Returns the wavelength of the cross connect.
35 + *
36 + * @return OCh signal
37 + */
38 + OchSignal ochSignal();
39 +
40 + /**
41 + * Returns true if cross connect is adding traffic.
42 + *
43 + * @return true if add rule, false if drop rule
44 + */
45 + boolean isAddRule();
46 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import org.apache.commons.lang3.tuple.Pair;
19 +import org.onosproject.net.flow.FlowId;
20 +
21 +/**
22 + * Simple interface to cache flow ID and priority of cross connect flows.
23 + */
24 +interface CrossConnectCache {
25 + /**
26 + * Returns the flow ID and priority corresponding to the flow hash.
27 + *
28 + * @param hash flow hash
29 + * @return flow ID and priority, null if not in cache
30 + */
31 + Pair<FlowId, Integer> get(int hash);
32 +
33 + /**
34 + * Stores the flow ID and priority corresponding to the flow hash.
35 + *
36 + * @param hash flow hash
37 + * @param flowId flow ID
38 + * @param priority flow priority
39 + */
40 + void set(int hash, FlowId flowId, int priority);
41 +
42 + /**
43 + * Removes the given hash from the cache.
44 + *
45 + * @param hash flow hash
46 + */
47 + void remove(int hash);
48 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import org.onosproject.net.OchSignal;
19 +import org.onosproject.net.PortNumber;
20 +import org.onosproject.net.flow.DefaultFlowRule;
21 +import org.onosproject.net.flow.FlowRule;
22 +import org.onosproject.net.flow.criteria.Criterion;
23 +import org.onosproject.net.flow.criteria.OchSignalCriterion;
24 +import org.onosproject.net.flow.criteria.OchSignalTypeCriterion;
25 +import org.onosproject.net.flow.criteria.PortCriterion;
26 +import org.onosproject.net.flow.instructions.Instruction;
27 +import org.onosproject.net.flow.instructions.Instructions;
28 +
29 +import java.util.List;
30 +import java.util.Set;
31 +
32 +import static com.google.common.base.Preconditions.checkArgument;
33 +
34 +/**
35 + * Cross connect abstraction based on a flow rule.
36 + */
37 +public class CrossConnectFlowRule extends DefaultFlowRule implements CrossConnect {
38 + private PortNumber addDrop;
39 + private OchSignal ochSignal;
40 + private boolean isAddRule;
41 +
42 + public CrossConnectFlowRule(FlowRule rule, List<PortNumber> linePorts) {
43 + super(rule);
44 +
45 + Set<Criterion> criteria = rule.selector().criteria();
46 + List<Instruction> instructions = rule.treatment().immediate();
47 +
48 + // Proper cross connect has criteria for input port, OChSignal and OCh signal type.
49 + // Instruction must be output to port.
50 + checkArgument(criteria.size() == 3, "Wrong size of flow rule criteria for cross connect.");
51 + checkArgument(instructions.size() == 1, "Wrong size of flow rule instructions for cross connect.");
52 + // FIXME: Ensure criteria has exactly one of each match type
53 + criteria.forEach(
54 + c -> checkArgument(c instanceof OchSignalCriterion ||
55 + c instanceof OchSignalTypeCriterion ||
56 + c instanceof PortCriterion,
57 + "Incompatible flow rule criteria for cross connect: " + criteria
58 + )
59 + );
60 + checkArgument(instructions.get(0).type() == Instruction.Type.OUTPUT,
61 + "Incompatible flow rule instructions for cross connect: " + instructions);
62 +
63 + ochSignal = criteria.stream()
64 + .filter(c -> c instanceof OchSignalCriterion)
65 + .map(c -> ((OchSignalCriterion) c).lambda())
66 + .findAny()
67 + .orElse(null);
68 +
69 + // Add or drop rule?
70 + Instructions.OutputInstruction outInstruction = (Instructions.OutputInstruction) instructions.get(0);
71 + if (linePorts.contains(outInstruction.port())) {
72 + addDrop = criteria.stream()
73 + .filter(c -> c instanceof PortCriterion)
74 + .map(c -> ((PortCriterion) c).port())
75 + .findAny()
76 + .orElse(null);
77 + isAddRule = true;
78 + } else {
79 + addDrop = outInstruction.port();
80 + isAddRule = false;
81 + }
82 + }
83 +
84 + @Override
85 + public PortNumber addDrop() {
86 + return addDrop;
87 + }
88 +
89 + @Override
90 + public OchSignal ochSignal() {
91 + return ochSignal;
92 + }
93 +
94 + @Override
95 + public boolean isAddRule() {
96 + return isAddRule;
97 + }
98 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import org.apache.commons.lang3.tuple.Pair;
19 +import org.apache.felix.scr.annotations.Component;
20 +import org.apache.felix.scr.annotations.Service;
21 +import org.onosproject.net.flow.FlowId;
22 +
23 +import java.util.HashMap;
24 +import java.util.Map;
25 +
26 +@Component(immediate = true, enabled = true)
27 +@Service
28 +public class DefaultCrossConnectCache implements CrossConnectCache {
29 + private final Map<Integer, Pair<FlowId, Integer>> cache = new HashMap<>();
30 +
31 + @Override
32 + public Pair<FlowId, Integer> get(int hash) {
33 + return cache.get(hash);
34 + }
35 +
36 + @Override
37 + public void set(int hash, FlowId flowId, int priority) {
38 + cache.put(hash, Pair.of(flowId, priority));
39 + }
40 +
41 + @Override
42 + public void remove(int hash) {
43 + cache.remove(hash);
44 + }
45 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import org.onlab.util.Frequency;
19 +import org.onlab.util.Spectrum;
20 +import org.onosproject.net.OchSignal;
21 +import org.onosproject.net.PortNumber;
22 +import org.onosproject.net.behaviour.LambdaQuery;
23 +import org.onosproject.net.driver.AbstractHandlerBehaviour;
24 +
25 +import java.util.Set;
26 +import java.util.stream.Collectors;
27 +import java.util.stream.IntStream;
28 +
29 +/**
30 + * Implementation of lambda query interface for Lumentum SDN ROADMs.
31 + *
32 + * Device supports 96 wavelengths of 50 GHz, between center frequencies 191.350 THz and 196.075 THz.
33 + */
34 +public class LambdaQueryLumentumRoadm extends AbstractHandlerBehaviour implements LambdaQuery {
35 + private static final int LAMBDA_COUNT = 96;
36 +
37 + @Override
38 + public Set<OchSignal> queryLambdas(PortNumber port) {
39 + int startMultiplier = (int) (LumentumSnmpDevice.START_CENTER_FREQ.subtract(Spectrum.CENTER_FREQUENCY).asHz()
40 + / Frequency.ofGHz(50).asHz());
41 +
42 + return IntStream.range(0, LAMBDA_COUNT)
43 + .mapToObj(x -> new OchSignal(LumentumSnmpDevice.GRID_TYPE,
44 + LumentumSnmpDevice.CHANNEL_SPACING,
45 + startMultiplier + x,
46 + 4))
47 + .collect(Collectors.toSet());
48 + }
49 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.drivers.lumentum;
18 +
19 +import org.apache.felix.scr.annotations.Component;
20 +import org.onosproject.net.driver.AbstractDriverLoader;
21 +
22 +/**
23 + * Loader for Lumentum device drivers from specific xml.
24 + */
25 +@Component(immediate = true)
26 +public class LumentumDriversLoader extends AbstractDriverLoader {
27 +
28 + public LumentumDriversLoader() {
29 + super("/lumentum-drivers.xml");
30 + }
31 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.drivers.lumentum;
17 +
18 +import com.google.common.base.Preconditions;
19 +import org.onlab.util.Frequency;
20 +import org.onosproject.net.ChannelSpacing;
21 +import org.onosproject.net.DeviceId;
22 +import org.onosproject.net.GridType;
23 +import org.snmp4j.CommunityTarget;
24 +import org.snmp4j.PDU;
25 +import org.snmp4j.Snmp;
26 +import org.snmp4j.TransportMapping;
27 +import org.snmp4j.event.ResponseEvent;
28 +import org.snmp4j.mp.SnmpConstants;
29 +import org.snmp4j.smi.Address;
30 +import org.snmp4j.smi.GenericAddress;
31 +import org.snmp4j.smi.OID;
32 +import org.snmp4j.smi.OctetString;
33 +import org.snmp4j.transport.DefaultUdpTransportMapping;
34 +import org.snmp4j.util.DefaultPDUFactory;
35 +import org.snmp4j.util.TreeEvent;
36 +import org.snmp4j.util.TreeUtils;
37 +
38 +import java.io.IOException;
39 +import java.util.List;
40 +
41 +/**
42 + * Quick and dirty device abstraction for SNMP-based Lumentum devices.
43 + *
44 + * TODO: Refactor once SnmpDevice is finished
45 + */
46 +public class LumentumSnmpDevice {
47 +
48 + private static final int MAX_SIZE_RESPONSE_PDU = 65535;
49 + private static final int MAX_REPETITIONS = 50; // Only 42 directed ports on our devices
50 +
51 + public static final GridType GRID_TYPE = GridType.DWDM;
52 + public static final ChannelSpacing CHANNEL_SPACING = ChannelSpacing.CHL_50GHZ;
53 + public static final Frequency START_CENTER_FREQ = Frequency.ofGHz(191_350);
54 + public static final Frequency END_CENTER_FREQ = Frequency.ofGHz(196_100);
55 +
56 + // Lumentum SDN ROADM has shifted channel plan.
57 + // Channel 36 corresponds to ITU-T center frequency, which has spacing multiplier 0.
58 + public static final int MULTIPLIER_SHIFT = 36;
59 +
60 + private Snmp snmp;
61 + private CommunityTarget target;
62 +
63 + public LumentumSnmpDevice(DeviceId did) throws IOException {
64 + String[] deviceComponents = did.toString().split(":");
65 + Preconditions.checkArgument(deviceComponents.length > 1);
66 +
67 + String ipAddress = deviceComponents[1];
68 + String port = deviceComponents[2];
69 +
70 + Address targetAddress = GenericAddress.parse("udp:" + ipAddress + "/" + port);
71 + TransportMapping transport = new DefaultUdpTransportMapping();
72 + transport.listen();
73 + snmp = new Snmp(transport);
74 +
75 + // setting up target
76 + target = new CommunityTarget();
77 + target.setCommunity(new OctetString("public"));
78 + target.setAddress(targetAddress);
79 + target.setRetries(3);
80 + target.setTimeout(1000 * 3);
81 + target.setVersion(SnmpConstants.version2c);
82 + target.setMaxSizeRequestPDU(MAX_SIZE_RESPONSE_PDU);
83 + }
84 +
85 + public ResponseEvent set(PDU pdu) throws IOException {
86 + return snmp.set(pdu, target);
87 + }
88 +
89 + public List<TreeEvent> get(OID oid) {
90 + TreeUtils treeUtils = new TreeUtils(snmp, new DefaultPDUFactory());
91 + treeUtils.setMaxRepetitions(MAX_REPETITIONS);
92 + return treeUtils.getSubtree(target, oid);
93 + }
94 +}
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +package org.onosproject.drivers.lumentum;
18 +
19 +import com.google.common.collect.Lists;
20 +import org.onosproject.net.AnnotationKeys;
21 +import org.onosproject.net.DefaultAnnotations;
22 +import org.onosproject.net.PortNumber;
23 +import org.onosproject.net.SparseAnnotations;
24 +import org.onosproject.net.behaviour.PortDiscovery;
25 +import org.onosproject.net.device.OmsPortDescription;
26 +import org.onosproject.net.device.PortDescription;
27 +import org.onosproject.net.driver.AbstractHandlerBehaviour;
28 +import org.slf4j.Logger;
29 +import org.snmp4j.smi.OID;
30 +import org.snmp4j.smi.VariableBinding;
31 +import org.snmp4j.util.TreeEvent;
32 +
33 +import java.io.IOException;
34 +import java.util.Collections;
35 +import java.util.List;
36 +
37 +import static org.slf4j.LoggerFactory.getLogger;
38 +
39 +/**
40 + * Discovers the ports of a Lumentum SDN ROADM device using SNMP.
41 + */
42 +public class PortDiscoveryLumentumRoadm extends AbstractHandlerBehaviour
43 + implements PortDiscovery {
44 +
45 + private final Logger log = getLogger(PortDiscoveryLumentumRoadm.class);
46 +
47 + private static final String CTRL_PORT_STATE = ".1.3.6.1.4.1.46184.1.4.1.1.3.";
48 +
49 + private LumentumSnmpDevice snmp;
50 +
51 + @Override
52 + public List<PortDescription> getPorts() {
53 + try {
54 + snmp = new LumentumSnmpDevice(handler().data().deviceId());
55 + } catch (IOException e) {
56 + log.error("Failed to connect to device: ", e);
57 +
58 + return Collections.emptyList();
59 + }
60 +
61 + List<PortDescription> ports = Lists.newLinkedList();
62 +
63 + OID[] oids = {
64 + new OID(CTRL_PORT_STATE + "1"),
65 + new OID(CTRL_PORT_STATE + "2")
66 + };
67 +
68 + for (OID oid : oids) {
69 +
70 + for (TreeEvent event : snmp.get(oid)) {
71 + if (event != null) {
72 + VariableBinding[] varBindings = event.getVariableBindings();
73 + for (VariableBinding varBinding : varBindings) {
74 + if (varBinding.getVariable().toInt() == 1) {
75 + int portNumber = varBinding.getOid().removeLast();
76 + int portDirection = varBinding.getOid().removeLast();
77 + SparseAnnotations ann = DefaultAnnotations.builder()
78 + .set(AnnotationKeys.PORT_NAME, portDirection + "-" + portNumber)
79 + .build();
80 + PortDescription p = new OmsPortDescription(
81 + PortNumber.portNumber(ports.size() + 1),
82 + true,
83 + LumentumSnmpDevice.START_CENTER_FREQ,
84 + LumentumSnmpDevice.END_CENTER_FREQ,
85 + LumentumSnmpDevice.CHANNEL_SPACING.frequency(),
86 + ann);
87 + ports.add(p);
88 + }
89 + }
90 + }
91 + }
92 + }
93 +
94 + // Create LINE IN and LINE OUT ports as these are not reported through SNMP
95 + SparseAnnotations annLineIn = DefaultAnnotations.builder()
96 + .set(AnnotationKeys.PORT_NAME, "LINE IN")
97 + .build();
98 + ports.add(new OmsPortDescription(
99 + PortNumber.portNumber(ports.size() + 1),
100 + true,
101 + LumentumSnmpDevice.START_CENTER_FREQ,
102 + LumentumSnmpDevice.END_CENTER_FREQ,
103 + LumentumSnmpDevice.CHANNEL_SPACING.frequency(),
104 + annLineIn
105 + ));
106 +
107 + SparseAnnotations annLineOut = DefaultAnnotations.builder()
108 + .set(AnnotationKeys.PORT_NAME, "LINE OUT")
109 + .build();
110 + ports.add(new OmsPortDescription(
111 + PortNumber.portNumber(ports.size() + 1),
112 + true,
113 + LumentumSnmpDevice.START_CENTER_FREQ,
114 + LumentumSnmpDevice.END_CENTER_FREQ,
115 + LumentumSnmpDevice.CHANNEL_SPACING.frequency(),
116 + annLineOut
117 + ));
118 +
119 + return ports;
120 + }
121 +}
122 +
123 +
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/**
18 + * Package for Lumentum device drivers.
19 + */
20 +package org.onosproject.drivers.lumentum;
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!--
3 + ~ Copyright 2016 Open Networking Laboratory
4 + ~
5 + ~ Licensed under the Apache License, Version 2.0 (the "License");
6 + ~ you may not use this file except in compliance with the License.
7 + ~ You may obtain a copy of the License at
8 + ~
9 + ~ http://www.apache.org/licenses/LICENSE-2.0
10 + ~
11 + ~ Unless required by applicable law or agreed to in writing, software
12 + ~ distributed under the License is distributed on an "AS IS" BASIS,
13 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + ~ See the License for the specific language governing permissions and
15 + ~ limitations under the License.
16 + -->
17 +<drivers>
18 + <driver name="lumentum" manufacturer="Lumentum" hwVersion="SDN ROADM" swVersion="1.0">
19 + <behaviour api="org.onosproject.net.behaviour.PortDiscovery"
20 + impl="org.onosproject.drivers.lumentum.PortDiscoveryLumentumRoadm"/>
21 + <behaviour api="org.onosproject.net.behaviour.LambdaQuery"
22 + impl="org.onosproject.drivers.lumentum.LambdaQueryLumentumRoadm"/>
23 + <behaviour api="org.onosproject.net.flow.FlowRuleProgrammable"
24 + impl="org.onosproject.drivers.lumentum.LumentumFlowRuleDriver"/>
25 + </driver>
26 +</drivers>
27 +
...@@ -58,7 +58,7 @@ public class NetconfControllerConfig extends AbstractHandlerBehaviour ...@@ -58,7 +58,7 @@ public class NetconfControllerConfig extends AbstractHandlerBehaviour
58 controllers.addAll(XmlConfigParser.parseStreamControllers(XmlConfigParser. 58 controllers.addAll(XmlConfigParser.parseStreamControllers(XmlConfigParser.
59 loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8))))); 59 loadXml(new ByteArrayInputStream(reply.getBytes(StandardCharsets.UTF_8)))));
60 } catch (IOException e) { 60 } catch (IOException e) {
61 - log.error("Cannot comunicate to device {} ", ofDeviceId); 61 + log.error("Cannot communicate with device {} ", ofDeviceId);
62 } 62 }
63 return controllers; 63 return controllers;
64 } 64 }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
39 <module>netconf</module> 39 <module>netconf</module>
40 <module>ovsdb</module> 40 <module>ovsdb</module>
41 <module>utilities</module> 41 <module>utilities</module>
42 + <module>lumentum</module>
42 </modules> 43 </modules>
43 44
44 <!--<properties> 45 <!--<properties>
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
16 16
17 package org.onosproject.openflow.controller.driver; 17 package org.onosproject.openflow.controller.driver;
18 18
19 -import static org.onlab.util.Tools.groupedThreads;
20 -
21 import com.google.common.collect.Lists; 19 import com.google.common.collect.Lists;
22 import org.jboss.netty.channel.Channel; 20 import org.jboss.netty.channel.Channel;
23 import org.onlab.packet.IpAddress; 21 import org.onlab.packet.IpAddress;
...@@ -26,23 +24,21 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour; ...@@ -26,23 +24,21 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour;
26 import org.onosproject.openflow.controller.Dpid; 24 import org.onosproject.openflow.controller.Dpid;
27 import org.onosproject.openflow.controller.OpenFlowEventListener; 25 import org.onosproject.openflow.controller.OpenFlowEventListener;
28 import org.onosproject.openflow.controller.RoleState; 26 import org.onosproject.openflow.controller.RoleState;
29 -
30 import org.projectfloodlight.openflow.protocol.OFDescStatsReply; 27 import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
28 +import org.projectfloodlight.openflow.protocol.OFErrorMsg;
29 +import org.projectfloodlight.openflow.protocol.OFExperimenter;
30 +import org.projectfloodlight.openflow.protocol.OFFactories;
31 +import org.projectfloodlight.openflow.protocol.OFFactory;
31 import org.projectfloodlight.openflow.protocol.OFFeaturesReply; 32 import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
32 -import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
33 -import org.projectfloodlight.openflow.protocol.OFVersion;
34 import org.projectfloodlight.openflow.protocol.OFMessage; 33 import org.projectfloodlight.openflow.protocol.OFMessage;
35 -import org.projectfloodlight.openflow.protocol.OFType;
36 -import org.projectfloodlight.openflow.protocol.OFFactories;
37 -import org.projectfloodlight.openflow.protocol.OFPortDesc;
38 -import org.projectfloodlight.openflow.protocol.OFExperimenter;
39 -import org.projectfloodlight.openflow.protocol.OFErrorMsg;
40 -import org.projectfloodlight.openflow.protocol.OFRoleRequest;
41 import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleRequest; 34 import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleRequest;
35 +import org.projectfloodlight.openflow.protocol.OFPortDesc;
36 +import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
42 import org.projectfloodlight.openflow.protocol.OFPortStatus; 37 import org.projectfloodlight.openflow.protocol.OFPortStatus;
43 -import org.projectfloodlight.openflow.protocol.OFFactory;
44 import org.projectfloodlight.openflow.protocol.OFRoleReply; 38 import org.projectfloodlight.openflow.protocol.OFRoleReply;
45 - 39 +import org.projectfloodlight.openflow.protocol.OFRoleRequest;
40 +import org.projectfloodlight.openflow.protocol.OFType;
41 +import org.projectfloodlight.openflow.protocol.OFVersion;
46 import org.slf4j.Logger; 42 import org.slf4j.Logger;
47 import org.slf4j.LoggerFactory; 43 import org.slf4j.LoggerFactory;
48 44
...@@ -60,6 +56,8 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -60,6 +56,8 @@ import java.util.concurrent.atomic.AtomicInteger;
60 import java.util.concurrent.atomic.AtomicReference; 56 import java.util.concurrent.atomic.AtomicReference;
61 import java.util.stream.Collectors; 57 import java.util.stream.Collectors;
62 58
59 +import static org.onlab.util.Tools.groupedThreads;
60 +
63 /** 61 /**
64 * An abstract representation of an OpenFlow switch. Can be extended by others 62 * An abstract representation of an OpenFlow switch. Can be extended by others
65 * to serve as a base for their vendor specific representation of a switch. 63 * to serve as a base for their vendor specific representation of a switch.
...@@ -200,7 +198,8 @@ public abstract class AbstractOpenFlowSwitch extends AbstractHandlerBehaviour ...@@ -200,7 +198,8 @@ public abstract class AbstractOpenFlowSwitch extends AbstractHandlerBehaviour
200 } 198 }
201 199
202 @Override 200 @Override
203 - public final void sendHandshakeMessage(OFMessage message) { 201 + public final void
202 + sendHandshakeMessage(OFMessage message) {
204 if (!this.isDriverHandshakeComplete()) { 203 if (!this.isDriverHandshakeComplete()) {
205 sendMsgsOnChannel(Collections.singletonList(message)); 204 sendMsgsOnChannel(Collections.singletonList(message));
206 } 205 }
......
...@@ -15,24 +15,10 @@ ...@@ -15,24 +15,10 @@
15 */ 15 */
16 package org.onosproject.provider.of.device.impl; 16 package org.onosproject.provider.of.device.impl;
17 17
18 -import static com.google.common.base.Preconditions.checkArgument; 18 +import com.google.common.base.Strings;
19 -import static com.google.common.base.Strings.isNullOrEmpty; 19 +import com.google.common.collect.Lists;
20 -import static org.onlab.util.Tools.get; 20 +import com.google.common.collect.Maps;
21 -import static org.onosproject.net.DeviceId.deviceId; 21 +import com.google.common.collect.Sets;
22 -import static org.onosproject.net.Port.Type.COPPER;
23 -import static org.onosproject.net.Port.Type.FIBER;
24 -import static org.onosproject.openflow.controller.Dpid.dpid;
25 -import static org.onosproject.openflow.controller.Dpid.uri;
26 -import static org.slf4j.LoggerFactory.getLogger;
27 -
28 -import java.util.ArrayList;
29 -import java.util.Collection;
30 -import java.util.Collections;
31 -import java.util.Dictionary;
32 -import java.util.HashMap;
33 -import java.util.HashSet;
34 -import java.util.List;
35 -
36 import org.apache.felix.scr.annotations.Activate; 22 import org.apache.felix.scr.annotations.Activate;
37 import org.apache.felix.scr.annotations.Component; 23 import org.apache.felix.scr.annotations.Component;
38 import org.apache.felix.scr.annotations.Deactivate; 24 import org.apache.felix.scr.annotations.Deactivate;
...@@ -82,6 +68,8 @@ import org.onosproject.openflow.controller.OpenFlowSwitchListener; ...@@ -82,6 +68,8 @@ import org.onosproject.openflow.controller.OpenFlowSwitchListener;
82 import org.onosproject.openflow.controller.PortDescPropertyType; 68 import org.onosproject.openflow.controller.PortDescPropertyType;
83 import org.onosproject.openflow.controller.RoleState; 69 import org.onosproject.openflow.controller.RoleState;
84 import org.osgi.service.component.ComponentContext; 70 import org.osgi.service.component.ComponentContext;
71 +import org.projectfloodlight.openflow.protocol.OFCalientPortDescProp;
72 +import org.projectfloodlight.openflow.protocol.OFCalientPortDescPropOptical;
85 import org.projectfloodlight.openflow.protocol.OFCalientPortDescStatsEntry; 73 import org.projectfloodlight.openflow.protocol.OFCalientPortDescStatsEntry;
86 import org.projectfloodlight.openflow.protocol.OFExpPort; 74 import org.projectfloodlight.openflow.protocol.OFExpPort;
87 import org.projectfloodlight.openflow.protocol.OFExpPortDescPropOpticalTransport; 75 import org.projectfloodlight.openflow.protocol.OFExpPortDescPropOpticalTransport;
...@@ -108,10 +96,23 @@ import org.projectfloodlight.openflow.protocol.OFVersion; ...@@ -108,10 +96,23 @@ import org.projectfloodlight.openflow.protocol.OFVersion;
108 import org.projectfloodlight.openflow.types.PortSpeed; 96 import org.projectfloodlight.openflow.types.PortSpeed;
109 import org.slf4j.Logger; 97 import org.slf4j.Logger;
110 98
111 -import com.google.common.base.Strings; 99 +import java.util.ArrayList;
112 -import com.google.common.collect.Lists; 100 +import java.util.Collection;
113 -import com.google.common.collect.Maps; 101 +import java.util.Collections;
114 -import com.google.common.collect.Sets; 102 +import java.util.Dictionary;
103 +import java.util.HashMap;
104 +import java.util.HashSet;
105 +import java.util.List;
106 +
107 +import static com.google.common.base.Preconditions.checkArgument;
108 +import static com.google.common.base.Strings.isNullOrEmpty;
109 +import static org.onlab.util.Tools.get;
110 +import static org.onosproject.net.DeviceId.deviceId;
111 +import static org.onosproject.net.Port.Type.COPPER;
112 +import static org.onosproject.net.Port.Type.FIBER;
113 +import static org.onosproject.openflow.controller.Dpid.dpid;
114 +import static org.onosproject.openflow.controller.Dpid.uri;
115 +import static org.slf4j.LoggerFactory.getLogger;
115 116
116 /** 117 /**
117 * Provider which uses an OpenFlow controller to detect network 118 * Provider which uses an OpenFlow controller to detect network
...@@ -691,9 +692,19 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -691,9 +692,19 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
691 private PortDescription buildPortDescription(OFCalientPortDescStatsEntry port) { 692 private PortDescription buildPortDescription(OFCalientPortDescStatsEntry port) {
692 PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); 693 PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber());
693 694
695 + // Use the alias name if it's available
696 + String name = port.getName();
697 + List<OFCalientPortDescProp> props = port.getProperties();
698 + if (props != null && props.size() > 0) {
699 + OFCalientPortDescPropOptical propOptical = (OFCalientPortDescPropOptical) props.get(0);
700 + if (propOptical != null) {
701 + name = propOptical.getInAlias();
702 + }
703 + }
704 +
694 // FIXME when Calient OF agent reports port status 705 // FIXME when Calient OF agent reports port status
695 boolean enabled = true; 706 boolean enabled = true;
696 - SparseAnnotations annotations = makePortAnnotation(port.getName(), port.getHwAddr().toString()); 707 + SparseAnnotations annotations = makePortAnnotation(name, port.getHwAddr().toString());
697 708
698 // S160 data sheet 709 // S160 data sheet
699 // Wavelength range: 1260 - 1630 nm, grid is irrelevant for this type of switch 710 // Wavelength range: 1260 - 1630 nm, grid is irrelevant for this type of switch
......
...@@ -19,14 +19,16 @@ import com.btisystems.pronx.ems.core.model.ClassRegistry; ...@@ -19,14 +19,16 @@ import com.btisystems.pronx.ems.core.model.ClassRegistry;
19 import com.btisystems.pronx.ems.core.model.IClassRegistry; 19 import com.btisystems.pronx.ems.core.model.IClassRegistry;
20 import com.btisystems.pronx.ems.core.model.NetworkDevice; 20 import com.btisystems.pronx.ems.core.model.NetworkDevice;
21 import com.btisystems.pronx.ems.core.snmp.ISnmpSession; 21 import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
22 -import java.io.IOException;
23 -import java.util.Arrays;
24 import org.onosproject.net.device.DefaultDeviceDescription; 22 import org.onosproject.net.device.DefaultDeviceDescription;
25 import org.onosproject.net.device.DeviceDescription; 23 import org.onosproject.net.device.DeviceDescription;
26 import org.slf4j.Logger; 24 import org.slf4j.Logger;
27 -import static org.slf4j.LoggerFactory.getLogger;
28 import org.snmp4j.smi.OID; 25 import org.snmp4j.smi.OID;
29 26
27 +import java.io.IOException;
28 +import java.util.Arrays;
29 +
30 +import static org.slf4j.LoggerFactory.getLogger;
31 +
30 /** 32 /**
31 * A vendor-specific implementation supporting BTI Systems BTI-7000 equipment. 33 * A vendor-specific implementation supporting BTI Systems BTI-7000 equipment.
32 * @deprecated 1.5.0 Falcon, not compliant with ONOS SB and driver architecture. 34 * @deprecated 1.5.0 Falcon, not compliant with ONOS SB and driver architecture.
...@@ -55,7 +57,7 @@ public class Bti7000DeviceDescriptionProvider implements SnmpDeviceDescriptionPr ...@@ -55,7 +57,7 @@ public class Bti7000DeviceDescriptionProvider implements SnmpDeviceDescriptionPr
55 String[] systemComponents = systemTree.getSysDescr().split(";"); 57 String[] systemComponents = systemTree.getSysDescr().split(";");
56 return new DefaultDeviceDescription(description.deviceUri(), description.type(), 58 return new DefaultDeviceDescription(description.deviceUri(), description.type(),
57 systemComponents[0], systemComponents[2], systemComponents[3], 59 systemComponents[0], systemComponents[2], systemComponents[3],
58 - UNKNOWN, description.chassisId()); 60 + UNKNOWN, description.chassisId(), description.annotations());
59 } 61 }
60 } catch (IOException ex) { 62 } catch (IOException ex) {
61 log.error("Error reading details for device {}.", session.getAddress(), ex); 63 log.error("Error reading details for device {}.", session.getAddress(), ex);
......
1 +/*
2 + * Copyright 2016 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.provider.snmp.device.impl;
17 +
18 +import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
19 +import org.onosproject.net.Device;
20 +import org.onosproject.net.device.DefaultDeviceDescription;
21 +import org.onosproject.net.device.DeviceDescription;
22 +import org.slf4j.Logger;
23 +import org.slf4j.LoggerFactory;
24 +
25 +/**
26 + * Device description provider for Lumentum SDN ROADMs.
27 + * @deprecated 1.5.0 Falcon, not compliant with ONOS SB and driver architecture.
28 + */
29 +@Deprecated
30 +public class LumentumDeviceDescriptionProvider implements SnmpDeviceDescriptionProvider {
31 +
32 + private static final Logger log = LoggerFactory.getLogger(LumentumDeviceDescriptionProvider.class);
33 +
34 + @Override
35 + public DeviceDescription populateDescription(ISnmpSession session, DeviceDescription description) {
36 + return new DefaultDeviceDescription(description.deviceUri(), Device.Type.ROADM,
37 + "Lumentum", "SDN ROADM", "1.0", "v1", description.chassisId(), description.annotations());
38 + }
39 +}
...@@ -19,15 +19,17 @@ import com.btisystems.pronx.ems.core.model.ClassRegistry; ...@@ -19,15 +19,17 @@ import com.btisystems.pronx.ems.core.model.ClassRegistry;
19 import com.btisystems.pronx.ems.core.model.IClassRegistry; 19 import com.btisystems.pronx.ems.core.model.IClassRegistry;
20 import com.btisystems.pronx.ems.core.model.NetworkDevice; 20 import com.btisystems.pronx.ems.core.model.NetworkDevice;
21 import com.btisystems.pronx.ems.core.snmp.ISnmpSession; 21 import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
22 -import java.io.IOException;
23 -import java.util.Arrays;
24 import org.apache.commons.lang.StringUtils; 22 import org.apache.commons.lang.StringUtils;
25 import org.onosproject.net.device.DefaultDeviceDescription; 23 import org.onosproject.net.device.DefaultDeviceDescription;
26 import org.onosproject.net.device.DeviceDescription; 24 import org.onosproject.net.device.DeviceDescription;
27 import org.slf4j.Logger; 25 import org.slf4j.Logger;
28 -import static org.slf4j.LoggerFactory.getLogger;
29 import org.snmp4j.smi.OID; 26 import org.snmp4j.smi.OID;
30 27
28 +import java.io.IOException;
29 +import java.util.Arrays;
30 +
31 +import static org.slf4j.LoggerFactory.getLogger;
32 +
31 /** 33 /**
32 * A agent-specific implementation supporting NET-SNMP agents. 34 * A agent-specific implementation supporting NET-SNMP agents.
33 * @deprecated 1.5.0 Falcon, not compliant with ONOS SB and driver architecture. 35 * @deprecated 1.5.0 Falcon, not compliant with ONOS SB and driver architecture.
...@@ -57,7 +59,7 @@ public class NetSnmpDeviceDescriptionProvider implements SnmpDeviceDescriptionPr ...@@ -57,7 +59,7 @@ public class NetSnmpDeviceDescriptionProvider implements SnmpDeviceDescriptionPr
57 // so cut it here until supported in prop displayer 59 // so cut it here until supported in prop displayer
58 String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20); 60 String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20);
59 return new DefaultDeviceDescription(description.deviceUri(), description.type(), manufacturer, 61 return new DefaultDeviceDescription(description.deviceUri(), description.type(), manufacturer,
60 - UNKNOWN, UNKNOWN, UNKNOWN, description.chassisId()); 62 + UNKNOWN, UNKNOWN, UNKNOWN, description.chassisId(), description.annotations());
61 } 63 }
62 } catch (IOException ex) { 64 } catch (IOException ex) {
63 log.error("Error reading details for device {}.", session.getAddress(), ex); 65 log.error("Error reading details for device {}.", session.getAddress(), ex);
......
...@@ -32,5 +32,4 @@ public interface SnmpDeviceDescriptionProvider { ...@@ -32,5 +32,4 @@ public interface SnmpDeviceDescriptionProvider {
32 */ 32 */
33 @Deprecated 33 @Deprecated
34 DeviceDescription populateDescription(ISnmpSession session, DeviceDescription description); 34 DeviceDescription populateDescription(ISnmpSession session, DeviceDescription description);
35 -
36 } 35 }
......
...@@ -32,9 +32,13 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; ...@@ -32,9 +32,13 @@ import org.apache.felix.scr.annotations.ReferenceCardinality;
32 import org.onlab.packet.ChassisId; 32 import org.onlab.packet.ChassisId;
33 import org.onosproject.cfg.ComponentConfigService; 33 import org.onosproject.cfg.ComponentConfigService;
34 import org.onosproject.cluster.ClusterService; 34 import org.onosproject.cluster.ClusterService;
35 +import org.onosproject.net.AnnotationKeys;
36 +import org.onosproject.net.DefaultAnnotations;
35 import org.onosproject.net.Device; 37 import org.onosproject.net.Device;
36 import org.onosproject.net.DeviceId; 38 import org.onosproject.net.DeviceId;
37 import org.onosproject.net.MastershipRole; 39 import org.onosproject.net.MastershipRole;
40 +import org.onosproject.net.SparseAnnotations;
41 +import org.onosproject.net.behaviour.PortDiscovery;
38 import org.onosproject.net.device.DefaultDeviceDescription; 42 import org.onosproject.net.device.DefaultDeviceDescription;
39 import org.onosproject.net.device.DeviceDescription; 43 import org.onosproject.net.device.DeviceDescription;
40 import org.onosproject.net.device.DeviceProvider; 44 import org.onosproject.net.device.DeviceProvider;
...@@ -120,6 +124,7 @@ public class SnmpDeviceProvider extends AbstractProvider ...@@ -120,6 +124,7 @@ public class SnmpDeviceProvider extends AbstractProvider
120 //TODO refactor, no hardcoding in provider, device information should be in drivers 124 //TODO refactor, no hardcoding in provider, device information should be in drivers
121 providers.put("1.3.6.1.4.1.18070.2.2", new Bti7000DeviceDescriptionProvider()); 125 providers.put("1.3.6.1.4.1.18070.2.2", new Bti7000DeviceDescriptionProvider());
122 providers.put("1.3.6.1.4.1.20408", new NetSnmpDeviceDescriptionProvider()); 126 providers.put("1.3.6.1.4.1.20408", new NetSnmpDeviceDescriptionProvider());
127 + providers.put("1.3.6.1.4.562.73.6", new LumentumDeviceDescriptionProvider());
123 } 128 }
124 129
125 @Activate 130 @Activate
...@@ -341,9 +346,12 @@ public class SnmpDeviceProvider extends AbstractProvider ...@@ -341,9 +346,12 @@ public class SnmpDeviceProvider extends AbstractProvider
341 DeviceId did = getDeviceId(); 346 DeviceId did = getDeviceId();
342 ChassisId cid = new ChassisId(); 347 ChassisId cid = new ChassisId();
343 348
349 + SparseAnnotations annotations = DefaultAnnotations.builder()
350 + .set(AnnotationKeys.PROTOCOL, SCHEME.toUpperCase())
351 + .build();
344 352
345 DeviceDescription desc = new DefaultDeviceDescription( 353 DeviceDescription desc = new DefaultDeviceDescription(
346 - did.uri(), Device.Type.OTHER, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, cid); 354 + did.uri(), Device.Type.OTHER, UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN, cid, annotations);
347 355
348 desc = populateDescriptionFromDevice(did, desc); 356 desc = populateDescriptionFromDevice(did, desc);
349 357
...@@ -353,6 +361,18 @@ public class SnmpDeviceProvider extends AbstractProvider ...@@ -353,6 +361,18 @@ public class SnmpDeviceProvider extends AbstractProvider
353 providerService.deviceConnected(did, desc); 361 providerService.deviceConnected(did, desc);
354 log.info("Done with Device Info Creation on ONOS core. Device Info: " 362 log.info("Done with Device Info Creation on ONOS core. Device Info: "
355 + device.deviceInfo() + " " + did.uri().toString()); 363 + device.deviceInfo() + " " + did.uri().toString());
364 +
365 + // Do port discovery if driver supports it
366 + Device d = deviceService.getDevice(did);
367 + if (d.is(PortDiscovery.class)) {
368 + PortDiscovery portConfig = d.as(PortDiscovery.class);
369 + if (portConfig != null) {
370 + providerService.updatePorts(did, portConfig.getPorts());
371 + }
372 + } else {
373 + log.warn("No port discovery behaviour for device {}", did);
374 + }
375 +
356 delay(EVENTINTERVAL); 376 delay(EVENTINTERVAL);
357 } catch (URISyntaxException e) { 377 } catch (URISyntaxException e) {
358 log.error("Syntax Error while creating URI for the device: " 378 log.error("Syntax Error while creating URI for the device: "
......
1 +
1 # 2 #
2 # devices which support SNMP, these may support SNMP fault-management. 3 # devices which support SNMP, these may support SNMP fault-management.
3 # demo.snmplabs.com is a publically available SNMP agent-simulator accessible via the internet, see http://snmpsim.sourceforge.net/public-snmp-simulator.html 4 # demo.snmplabs.com is a publically available SNMP agent-simulator accessible via the internet, see http://snmpsim.sourceforge.net/public-snmp-simulator.html
......