Committed by
Gerrit Code Review
Cisco Ios DeviceDescription
Change-Id: I51561c51fe18a6ee9676a894ec698e2a2fc222b4
Showing
6 changed files
with
404 additions
and
47 deletions
... | @@ -17,30 +17,56 @@ | ... | @@ -17,30 +17,56 @@ |
17 | package org.onosproject.drivers.cisco; | 17 | package org.onosproject.drivers.cisco; |
18 | 18 | ||
19 | import com.google.common.collect.ImmutableList; | 19 | import com.google.common.collect.ImmutableList; |
20 | -import org.onosproject.net.behaviour.PortDiscovery; | 20 | + |
21 | +import org.onosproject.net.Device; | ||
22 | +import org.onosproject.net.DeviceId; | ||
23 | +import org.onosproject.net.device.DefaultDeviceDescription; | ||
24 | +import org.onosproject.net.device.DeviceDescription; | ||
25 | +import org.onosproject.net.device.DeviceDescriptionDiscovery; | ||
26 | +import org.onosproject.net.device.DeviceService; | ||
21 | import org.onosproject.net.device.PortDescription; | 27 | import org.onosproject.net.device.PortDescription; |
22 | import org.onosproject.net.driver.AbstractHandlerBehaviour; | 28 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
23 | import org.onosproject.netconf.NetconfController; | 29 | import org.onosproject.netconf.NetconfController; |
30 | +import org.onosproject.netconf.NetconfException; | ||
24 | import org.onosproject.netconf.NetconfSession; | 31 | import org.onosproject.netconf.NetconfSession; |
25 | import org.slf4j.Logger; | 32 | import org.slf4j.Logger; |
26 | - | ||
27 | import java.io.IOException; | 33 | import java.io.IOException; |
28 | import java.util.List; | 34 | import java.util.List; |
29 | - | ||
30 | import static com.google.common.base.Preconditions.checkNotNull; | 35 | import static com.google.common.base.Preconditions.checkNotNull; |
31 | import static org.slf4j.LoggerFactory.getLogger; | 36 | import static org.slf4j.LoggerFactory.getLogger; |
32 | 37 | ||
33 | -/** | 38 | +public class CiscoIosDeviceDescription extends AbstractHandlerBehaviour |
34 | - * Retrieves the ports from Cisco IOS devices via netconf. | 39 | + implements DeviceDescriptionDiscovery { |
35 | - */ | 40 | + |
36 | -public class PortGetterCiscoIosImpl extends AbstractHandlerBehaviour | ||
37 | - implements PortDiscovery { | ||
38 | 41 | ||
39 | private final Logger log = getLogger(getClass()); | 42 | private final Logger log = getLogger(getClass()); |
43 | + private String version; | ||
40 | private String interfaces; | 44 | private String interfaces; |
41 | 45 | ||
42 | @Override | 46 | @Override |
43 | - public List<PortDescription> getPorts() { | 47 | + public DeviceDescription discoverDeviceDetails() { |
48 | + NetconfController controller = checkNotNull(handler().get(NetconfController.class)); | ||
49 | + NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession(); | ||
50 | + try { | ||
51 | + version = session.get(showVersionRequestBuilder()); | ||
52 | + } catch (IOException e) { | ||
53 | + throw new RuntimeException(new NetconfException("Failed to retrieve version info.", e)); | ||
54 | + } | ||
55 | + | ||
56 | + String[] details = TextBlockParserCisco.parseCiscoIosDeviceDetails(version); | ||
57 | + | ||
58 | + DeviceService deviceService = checkNotNull(handler().get(DeviceService.class)); | ||
59 | + DeviceId deviceId = handler().data().deviceId(); | ||
60 | + Device device = deviceService.getDevice(deviceId); | ||
61 | + | ||
62 | + return new DefaultDeviceDescription(device.id().uri(), Device.Type.SWITCH, | ||
63 | + details[0], details[1], | ||
64 | + details[2], details[3], | ||
65 | + device.chassisId()); | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public List<PortDescription> discoverPortDetails() { | ||
44 | NetconfController controller = checkNotNull(handler().get(NetconfController.class)); | 70 | NetconfController controller = checkNotNull(handler().get(NetconfController.class)); |
45 | NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession(); | 71 | NetconfSession session = controller.getDevicesMap().get(handler().data().deviceId()).getSession(); |
46 | try { | 72 | try { |
... | @@ -53,8 +79,30 @@ public class PortGetterCiscoIosImpl extends AbstractHandlerBehaviour | ... | @@ -53,8 +79,30 @@ public class PortGetterCiscoIosImpl extends AbstractHandlerBehaviour |
53 | } | 79 | } |
54 | 80 | ||
55 | /** | 81 | /** |
56 | - * Builds a request crafted to get the configuration required to create port | 82 | + * Builds a request crafted to get the configuration required to create |
57 | - * descriptions for the device. | 83 | + * details descriptions for the device. |
84 | + * | ||
85 | + * @return The request string. | ||
86 | + */ | ||
87 | + private String showVersionRequestBuilder() { | ||
88 | + StringBuilder rpc = new StringBuilder("<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"); | ||
89 | + rpc.append("<get>"); | ||
90 | + rpc.append("<filter>"); | ||
91 | + rpc.append("<config-format-text-block>"); | ||
92 | + rpc.append("<text-filter-spec> | include exp_to_match_run_conf </text-filter-spec>"); | ||
93 | + rpc.append("</config-format-text-block>"); | ||
94 | + rpc.append("<oper-data-format-text-block>"); | ||
95 | + rpc.append("<show>version</show>"); | ||
96 | + rpc.append("</oper-data-format-text-block>"); | ||
97 | + rpc.append("</filter>"); | ||
98 | + rpc.append("</get>"); | ||
99 | + rpc.append("</rpc>]]>]]>"); | ||
100 | + return rpc.toString(); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * Builds a request crafted to get the configuration required to create | ||
105 | + * details descriptions for the device. | ||
58 | * | 106 | * |
59 | * @return The request string. | 107 | * @return The request string. |
60 | */ | 108 | */ | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2016-present Open Networking Laboratory | 2 | +* Copyright 2016-present Open Networking Laboratory |
3 | - * | 3 | +* |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | +* You may obtain a copy of the License at |
7 | - * | 7 | +* |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | +* http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | +* |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | +* Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | +* distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | - * See the License for the specific language governing permissions and | 13 | +* See the License for the specific language governing permissions and |
14 | - * limitations under the License. | 14 | +* limitations under the License. |
15 | - */ | 15 | +*/ |
16 | 16 | ||
17 | package org.onosproject.drivers.cisco; | 17 | package org.onosproject.drivers.cisco; |
18 | 18 | ||
... | @@ -22,17 +22,22 @@ import org.onosproject.net.DefaultAnnotations; | ... | @@ -22,17 +22,22 @@ import org.onosproject.net.DefaultAnnotations; |
22 | import org.onosproject.net.PortNumber; | 22 | import org.onosproject.net.PortNumber; |
23 | import org.onosproject.net.device.DefaultPortDescription; | 23 | import org.onosproject.net.device.DefaultPortDescription; |
24 | import org.onosproject.net.device.PortDescription; | 24 | import org.onosproject.net.device.PortDescription; |
25 | - | ||
26 | import java.util.Arrays; | 25 | import java.util.Arrays; |
27 | import java.util.List; | 26 | import java.util.List; |
28 | 27 | ||
29 | import static org.onosproject.net.Port.Type; | 28 | import static org.onosproject.net.Port.Type; |
30 | 29 | ||
31 | /** | 30 | /** |
32 | - *Parser for Netconf configurations and replys as plain text. | 31 | + *Parser for Netconf XML configurations and replys as plain text. |
33 | */ | 32 | */ |
34 | -public final class TextBlockParserCisco { | 33 | +final class TextBlockParserCisco { |
35 | 34 | ||
35 | + private static final String PHRASE = "bytes of memory."; | ||
36 | + private static final String VERSION = "Version "; | ||
37 | + private static final String EOF_VERSION1 = "Software"; | ||
38 | + private static final String EOF_VERSION2 = "Software,"; | ||
39 | + private static final String EOF_VERSION3 = "RELEASE"; | ||
40 | + private static final String PROCESSOR_BOARD = "Processor board ID "; | ||
36 | private static final String BANDWIDTH = "BW "; | 41 | private static final String BANDWIDTH = "BW "; |
37 | private static final String SPEED = " Kbit/sec"; | 42 | private static final String SPEED = " Kbit/sec"; |
38 | private static final String ETHERNET = "Eth"; | 43 | private static final String ETHERNET = "Eth"; |
... | @@ -41,17 +46,107 @@ public final class TextBlockParserCisco { | ... | @@ -41,17 +46,107 @@ public final class TextBlockParserCisco { |
41 | private static final String FDDI = "Fdd"; | 46 | private static final String FDDI = "Fdd"; |
42 | private static final String POS = "POS"; | 47 | private static final String POS = "POS"; |
43 | private static final String SERIAL = "Ser"; | 48 | private static final String SERIAL = "Ser"; |
44 | - private static final List INTERFACES = Arrays.asList(ETHERNET, FASTETHERNET, GIGABITETHERNET, SERIAL, FDDI, POS); | ||
45 | - private static final List FIBERINTERFACES = Arrays.asList(FDDI, POS); | ||
46 | - | ||
47 | private static final String NEWLINE_SPLITTER = "\n"; | 49 | private static final String NEWLINE_SPLITTER = "\n"; |
48 | private static final String PORT_DELIMITER = "/"; | 50 | private static final String PORT_DELIMITER = "/"; |
49 | private static final String SPACE = " "; | 51 | private static final String SPACE = " "; |
50 | private static final String IS_UP = "is up, line protocol is up"; | 52 | private static final String IS_UP = "is up, line protocol is up"; |
53 | + private static final List INTERFACES = Arrays.asList(ETHERNET, FASTETHERNET, GIGABITETHERNET, SERIAL, FDDI, POS); | ||
54 | + private static final List FIBERINTERFACES = Arrays.asList(FDDI, POS); | ||
51 | 55 | ||
52 | 56 | ||
53 | private TextBlockParserCisco() { | 57 | private TextBlockParserCisco() { |
54 | - //not called, preventing any allocation | 58 | + //not called |
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * Adding information in an array for CiscoIosDeviceDescriptin call. | ||
63 | + * @param version the return of show version command | ||
64 | + * @return the array with the information | ||
65 | + */ | ||
66 | + static String[] parseCiscoIosDeviceDetails(String version) { | ||
67 | + String[] details = new String[4]; | ||
68 | + details[0] = getManufacturer(version); | ||
69 | + details[1] = getHwVersion(version); | ||
70 | + details[2] = getSwVersion(version); | ||
71 | + details[3] = serialNumber(version); | ||
72 | + return details; | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * Retrieving manufacturer of device. | ||
77 | + * @param version the return of show version command | ||
78 | + * @return the manufacturer of the device | ||
79 | + */ | ||
80 | + private static String getManufacturer(String version) { | ||
81 | + int i; | ||
82 | + String[] textStr = version.split(NEWLINE_SPLITTER); | ||
83 | + String[] lineStr = textStr[0].trim().split(SPACE); | ||
84 | + return lineStr[0]; | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
88 | + * Retrieving hardware version of device. | ||
89 | + * @param version the return of show version command | ||
90 | + * @return the hardware version of the device | ||
91 | + */ | ||
92 | + private static String getHwVersion(String version) { | ||
93 | + String[] textStr = version.split(NEWLINE_SPLITTER); | ||
94 | + String processor = SPACE; | ||
95 | + int i; | ||
96 | + for (i = 0; i < textStr.length; i++) { | ||
97 | + if (textStr[i].indexOf(PHRASE) > 0) { | ||
98 | + String[] lineStr = textStr[i].trim().split(SPACE); | ||
99 | + processor = lineStr[1]; | ||
100 | + break; | ||
101 | + } else { | ||
102 | + processor = SPACE; | ||
103 | + } | ||
104 | + } | ||
105 | + return processor; | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Retrieving software version of device. | ||
110 | + * @param version the return of show version command | ||
111 | + * @return the software version of the device | ||
112 | + */ | ||
113 | + private static String getSwVersion(String version) { | ||
114 | + String[] textStr = version.split(NEWLINE_SPLITTER); | ||
115 | + int i; | ||
116 | + for (i = 0; i < textStr.length; i++) { | ||
117 | + if (textStr[i].indexOf(VERSION) > 0) { | ||
118 | + break; | ||
119 | + } | ||
120 | + } | ||
121 | + String[] lineStr = textStr[i].trim().split(SPACE); | ||
122 | + StringBuilder sw = new StringBuilder(); | ||
123 | + for (int j = 0; j < lineStr.length; j++) { | ||
124 | + if (lineStr[j].equals(EOF_VERSION1) || lineStr[j].equals(EOF_VERSION2) | ||
125 | + ) { | ||
126 | + sw.append(lineStr[j - 1]).append(SPACE); | ||
127 | + } else if (lineStr[j].equals(EOF_VERSION3)) { | ||
128 | + sw.append(lineStr[j - 1]); | ||
129 | + sw.setLength(sw.length() - 1); | ||
130 | + } | ||
131 | + } | ||
132 | + return sw.toString(); | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * Retrieving serial number of device. | ||
137 | + * @param version the return of show version command | ||
138 | + * @return the serial number of the device | ||
139 | + */ | ||
140 | + private static String serialNumber(String version) { | ||
141 | + String[] textStr = version.split(NEWLINE_SPLITTER); | ||
142 | + int i; | ||
143 | + for (i = 0; i < textStr.length; i++) { | ||
144 | + if (textStr[i].indexOf(PROCESSOR_BOARD) > 0) { | ||
145 | + break; | ||
146 | + } | ||
147 | + } | ||
148 | + return textStr[i].substring(textStr[i].indexOf(PROCESSOR_BOARD) + PROCESSOR_BOARD.length(), | ||
149 | + textStr[i].length()); | ||
55 | } | 150 | } |
56 | 151 | ||
57 | /** | 152 | /** |
... | @@ -90,7 +185,7 @@ public final class TextBlockParserCisco { | ... | @@ -90,7 +185,7 @@ public final class TextBlockParserCisco { |
90 | long portSpeed = getPortSpeed(textStr); | 185 | long portSpeed = getPortSpeed(textStr); |
91 | DefaultAnnotations.Builder annotations = DefaultAnnotations.builder() | 186 | DefaultAnnotations.Builder annotations = DefaultAnnotations.builder() |
92 | .set(AnnotationKeys.PORT_NAME, firstWord); | 187 | .set(AnnotationKeys.PORT_NAME, firstWord); |
93 | - return port == "-1" ? null : new DefaultPortDescription(PortNumber.portNumber(port), | 188 | + return port.equals("-1") ? null : new DefaultPortDescription(PortNumber.portNumber(port), |
94 | isEnabled, type, portSpeed, annotations.build()); | 189 | isEnabled, type, portSpeed, annotations.build()); |
95 | } | 190 | } |
96 | 191 | ||
... | @@ -132,10 +227,10 @@ public final class TextBlockParserCisco { | ... | @@ -132,10 +227,10 @@ public final class TextBlockParserCisco { |
132 | if (!(firstCharacter.equals(SPACE)) && isChild) { | 227 | if (!(firstCharacter.equals(SPACE)) && isChild) { |
133 | break; | 228 | break; |
134 | } else if (firstCharacter.equals(SPACE) && isChild) { | 229 | } else if (firstCharacter.equals(SPACE) && isChild) { |
135 | - anInterface.append(textStr[i] + NEWLINE_SPLITTER); | 230 | + anInterface.append(textStr[i]).append(NEWLINE_SPLITTER); |
136 | } else if (INTERFACES.contains(first3Characters)) { | 231 | } else if (INTERFACES.contains(first3Characters)) { |
137 | isChild = true; | 232 | isChild = true; |
138 | - anInterface.append(textStr[i] + NEWLINE_SPLITTER); | 233 | + anInterface.append(textStr[i]).append(NEWLINE_SPLITTER); |
139 | } | 234 | } |
140 | } | 235 | } |
141 | return anInterface.toString(); | 236 | return anInterface.toString(); |
... | @@ -200,4 +295,4 @@ public final class TextBlockParserCisco { | ... | @@ -200,4 +295,4 @@ public final class TextBlockParserCisco { |
200 | return portSpeed; | 295 | return portSpeed; |
201 | } | 296 | } |
202 | 297 | ||
203 | -} | 298 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | hwVersion="" swVersion="IOS"> | 19 | hwVersion="" swVersion="IOS"> |
20 | <behaviour api="org.onosproject.net.behaviour.InterfaceConfig" | 20 | <behaviour api="org.onosproject.net.behaviour.InterfaceConfig" |
21 | impl="org.onosproject.drivers.cisco.InterfaceConfigCiscoIosImpl"/> | 21 | impl="org.onosproject.drivers.cisco.InterfaceConfigCiscoIosImpl"/> |
22 | - <behaviour api="org.onosproject.net.behaviour.PortDiscovery" | 22 | + <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery" |
23 | - impl="org.onosproject.drivers.cisco.PortGetterCiscoIosImpl"/> | 23 | + impl="org.onosproject.drivers.cisco.CiscoIosDeviceDescription"/> |
24 | </driver> | 24 | </driver> |
25 | </drivers> | 25 | </drivers> | ... | ... |
... | @@ -18,21 +18,24 @@ package org.onosproject.drivers.cisco; | ... | @@ -18,21 +18,24 @@ package org.onosproject.drivers.cisco; |
18 | 18 | ||
19 | 19 | ||
20 | import org.junit.Test; | 20 | import org.junit.Test; |
21 | +import org.onlab.packet.ChassisId; | ||
21 | import org.onosproject.net.AnnotationKeys; | 22 | import org.onosproject.net.AnnotationKeys; |
22 | import org.onosproject.net.DefaultAnnotations; | 23 | import org.onosproject.net.DefaultAnnotations; |
24 | +import org.onosproject.net.DefaultDevice; | ||
25 | +import org.onosproject.net.DeviceId; | ||
23 | import org.onosproject.net.Port; | 26 | import org.onosproject.net.Port; |
24 | import org.onosproject.net.PortNumber; | 27 | import org.onosproject.net.PortNumber; |
25 | import org.onosproject.net.device.DefaultPortDescription; | 28 | import org.onosproject.net.device.DefaultPortDescription; |
26 | import org.onosproject.net.device.PortDescription; | 29 | import org.onosproject.net.device.PortDescription; |
27 | - | 30 | +import org.onosproject.net.provider.ProviderId; |
28 | import java.io.InputStream; | 31 | import java.io.InputStream; |
29 | -import java.util.Scanner; | ||
30 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
31 | import java.util.List; | 33 | import java.util.List; |
32 | - | 34 | +import java.util.Scanner; |
33 | - | ||
34 | - | ||
35 | import static org.junit.Assert.assertEquals; | 35 | import static org.junit.Assert.assertEquals; |
36 | +import static org.onosproject.net.Device.Type.SWITCH; | ||
37 | +import static org.onosproject.net.DeviceId.deviceId; | ||
38 | + | ||
36 | 39 | ||
37 | /** | 40 | /** |
38 | * Tests the parser for Netconf TextBlock configurations and replies from Cisco devices. | 41 | * Tests the parser for Netconf TextBlock configurations and replies from Cisco devices. |
... | @@ -59,17 +62,47 @@ public class TextBlockParserCiscoTest { | ... | @@ -59,17 +62,47 @@ public class TextBlockParserCiscoTest { |
59 | private static final long CONNECTION_SPEED_FDDI = 100000; | 62 | private static final long CONNECTION_SPEED_FDDI = 100000; |
60 | private static final boolean IS_ENABLED = true; | 63 | private static final boolean IS_ENABLED = true; |
61 | private static final boolean IS_NOT_ENABLED = false; | 64 | private static final boolean IS_NOT_ENABLED = false; |
62 | - private static final String TEXT_FILE = "/CiscoIosInterfaces.xml"; | 65 | + private static final String SHOW_VERSION = "/testShowVersion.xml"; |
66 | + private static final String SHOW_INTFS = "/testShowInterfaces.xml"; | ||
67 | + private static final String SW = "IOS C3560E 15.0(2)EJ"; | ||
68 | + private static final String HW = "SM-X-ES3-24-P"; | ||
69 | + private static final String MFR = "Cisco"; | ||
70 | + private static final String SN = "FOC18401Z3R"; | ||
71 | + private static final ProviderId PROVIDERID = new ProviderId("of", "foo"); | ||
72 | + private static final DeviceId DEVICE = deviceId("of:foo"); | ||
73 | + private static final ChassisId CID = new ChassisId(); | ||
63 | 74 | ||
64 | @Test | 75 | @Test |
65 | - public void controllersConfig() { | 76 | + public void controllersVersion() { |
66 | - InputStream streamOrig = getClass().getResourceAsStream(TEXT_FILE); | 77 | + InputStream streamOrig = getClass().getResourceAsStream(SHOW_VERSION); |
78 | + String version = new Scanner(streamOrig, "UTF-8").useDelimiter("\\Z").next(); | ||
79 | + version = version.substring(version.indexOf('\n') + 1); | ||
80 | + String[] actualDetails = TextBlockParserCisco.parseCiscoIosDeviceDetails(version); | ||
81 | + | ||
82 | + assertEquals("Information could not be retrieved", | ||
83 | + getExpectedInfo(), actualInfo(actualDetails)); | ||
84 | + } | ||
85 | + | ||
86 | + @Test | ||
87 | + public void controllersIntfs() { | ||
88 | + InputStream streamOrig = getClass().getResourceAsStream(SHOW_INTFS); | ||
67 | String rpcReply = new Scanner(streamOrig, "UTF-8").useDelimiter("\\Z").next(); | 89 | String rpcReply = new Scanner(streamOrig, "UTF-8").useDelimiter("\\Z").next(); |
68 | List<PortDescription> actualIntfs = TextBlockParserCisco.parseCiscoIosPorts(rpcReply); | 90 | List<PortDescription> actualIntfs = TextBlockParserCisco.parseCiscoIosPorts(rpcReply); |
69 | - assertEquals("Interfaces were not retrieved from configuration", | 91 | + assertEquals("Information could not be retrieved", |
70 | getExpectedIntfs(), actualIntfs); | 92 | getExpectedIntfs(), actualIntfs); |
71 | } | 93 | } |
72 | 94 | ||
95 | + private DefaultDevice getExpectedInfo() { | ||
96 | + return new DefaultDevice(PROVIDERID, DEVICE, SWITCH, MFR, HW, SW, SN, CID); | ||
97 | + } | ||
98 | + | ||
99 | + private DefaultDevice actualInfo(String[] actualDetails) { | ||
100 | + | ||
101 | + return new DefaultDevice(PROVIDERID, DEVICE, SWITCH, actualDetails[0], | ||
102 | + actualDetails[1], actualDetails[2], | ||
103 | + actualDetails[3], CID); | ||
104 | + } | ||
105 | + | ||
73 | private List<PortDescription> getExpectedIntfs() { | 106 | private List<PortDescription> getExpectedIntfs() { |
74 | DefaultAnnotations.Builder int1Annotations = DefaultAnnotations.builder() | 107 | DefaultAnnotations.Builder int1Annotations = DefaultAnnotations.builder() |
75 | .set(AnnotationKeys.PORT_NAME, INTF1_NAME); | 108 | .set(AnnotationKeys.PORT_NAME, INTF1_NAME); |
... | @@ -99,4 +132,5 @@ public class TextBlockParserCiscoTest { | ... | @@ -99,4 +132,5 @@ public class TextBlockParserCiscoTest { |
99 | int6Annotations.build())); | 132 | int6Annotations.build())); |
100 | return intfs; | 133 | return intfs; |
101 | } | 134 | } |
135 | + | ||
102 | } | 136 | } | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?><rpc-reply message-id="7" xmlns="urn:ietf:params:netconf:base:1.0"><data><cli-oper-data-block><item><show>interfaces</show><response> | ||
2 | +FastEthernet0/0 is up, line protocol is up | ||
3 | + Hardware is i82543 (Livengood), address is ca00.12b5.0008 (bia ca00.12b5.0008) | ||
4 | + Internet address is 192.168.1.20/24 | ||
5 | + MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, | ||
6 | + reliability 255/255, txload 1/255, rxload 1/255 | ||
7 | + Encapsulation ARPA, loopback not set | ||
8 | + Keepalive set (10 sec) | ||
9 | + Full-duplex, 100Mb/s, 100BaseTX/FX | ||
10 | + ARP type: ARPA, ARP Timeout 04:00:00 | ||
11 | + Last input 00:00:00, output 00:00:00, output hang never | ||
12 | + Last clearing of "show interface" counters never | ||
13 | + Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 | ||
14 | + Queueing strategy: fifo | ||
15 | + Output queue: 0/40 (size/max) | ||
16 | + 5 minute input rate 2000 bits/sec, 1 packets/sec | ||
17 | + 5 minute output rate 0 bits/sec, 0 packets/sec | ||
18 | + 3589 packets input, 681498 bytes | ||
19 | + Received 2459 broadcasts, 0 runts, 0 giants, 0 throttles | ||
20 | + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored | ||
21 | + 0 watchdog | ||
22 | + 0 input packets with dribble condition detected | ||
23 | + 2518 packets output, 242991 bytes, 0 underruns | ||
24 | + 0 output errors, 0 collisions, 2 interface resets | ||
25 | + 149 unknown protocol drops | ||
26 | + 0 babbles, 0 late collision, 0 deferred | ||
27 | + 0 lost carrier, 0 no carrier | ||
28 | + 0 output buffer failures, 0 output buffers swapped out | ||
29 | +Ethernet1/0 is administratively down, line protocol is down | ||
30 | + Hardware is i82543 (Livengood), address is ca00.12b5.0006 (bia ca00.12b5.0006) | ||
31 | + MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, | ||
32 | + reliability 255/255, txload 1/255, rxload 1/255 | ||
33 | + Encapsulation ARPA, loopback not set | ||
34 | + Keepalive set (10 sec) | ||
35 | + Full-duplex, 100Mb/s, 100BaseTX/FX | ||
36 | + ARP type: ARPA, ARP Timeout 04:00:00 | ||
37 | + Last input never, output never, output hang never | ||
38 | + Last clearing of "show interface" counters never | ||
39 | + Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 | ||
40 | + Queueing strategy: fifo | ||
41 | + Output queue: 0/40 (size/max) | ||
42 | + 5 minute input rate 0 bits/sec, 0 packets/sec | ||
43 | + 5 minute output rate 0 bits/sec, 0 packets/sec | ||
44 | + 0 packets input, 0 bytes | ||
45 | + Received 0 broadcasts, 0 runts, 0 giants, 0 throttles | ||
46 | + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored | ||
47 | + 0 watchdog | ||
48 | + 0 input packets with dribble condition detected | ||
49 | + 0 packets output, 0 bytes, 0 underruns | ||
50 | + 0 output errors, 0 collisions, 0 interface resets | ||
51 | + 0 unknown protocol drops | ||
52 | + 0 babbles, 0 late collision, 0 deferred | ||
53 | + 0 lost carrier, 0 no carrier | ||
54 | + 0 output buffer failures, 0 output buffers swapped out | ||
55 | +GigabitEthernet2/0 is administratively down, line protocol is down | ||
56 | + Hardware is i82543 (Livengood), address is ca00.12b5.0006 (bia ca00.12b5.0006) | ||
57 | + MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec, | ||
58 | + reliability 255/255, txload 1/255, rxload 1/255 | ||
59 | + Encapsulation ARPA, loopback not set | ||
60 | + Keepalive set (10 sec) | ||
61 | + Full-duplex, 100Mb/s, 100BaseTX/FX | ||
62 | + ARP type: ARPA, ARP Timeout 04:00:00 | ||
63 | + Last input never, output never, output hang never | ||
64 | + Last clearing of "show interface" counters never | ||
65 | + Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 | ||
66 | + Queueing strategy: fifo | ||
67 | + Output queue: 0/40 (size/max) | ||
68 | + 5 minute input rate 0 bits/sec, 0 packets/sec | ||
69 | + 5 minute output rate 0 bits/sec, 0 packets/sec | ||
70 | + 0 packets input, 0 bytes | ||
71 | + Received 0 broadcasts, 0 runts, 0 giants, 0 throttles | ||
72 | + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored | ||
73 | + 0 watchdog | ||
74 | + 0 input packets with dribble condition detected | ||
75 | + 0 packets output, 0 bytes, 0 underruns | ||
76 | + 0 output errors, 0 collisions, 0 interface resets | ||
77 | + 0 unknown protocol drops | ||
78 | + 0 babbles, 0 late collision, 0 deferred | ||
79 | + 0 lost carrier, 0 no carrier | ||
80 | + 0 output buffer failures, 0 output buffers swapped out | ||
81 | +Serial3/0 is up, line protocol is up | ||
82 | + Hardware is MCI Serial | ||
83 | + Internet address is 192.168.10.203, subnet mask is 255.255.255.0 | ||
84 | + MTU 1500 bytes, BW 1544 Kbit/sec, DLY 20000 usec, rely 255/255, load 1/255 | ||
85 | + Encapsulation HDLC, loopback not set, keepalive set (10 sec) | ||
86 | + Last input 0:00:07, output 0:00:00, output hang never | ||
87 | + Output queue 0/40, 0 drops; input queue 0/75, 0 drops | ||
88 | + 5 minute input rate 0 bits/sec, 0 packets/sec | ||
89 | + 5 minute output rate 0 bits/sec, 0 packets/sec | ||
90 | + 16263 packets input, 1347238 bytes, 0 no buffer | ||
91 | + Received 13983 broadcasts, 0 runts, 0 giants | ||
92 | + 2 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 2 abort | ||
93 | + 1 carrier transitions | ||
94 | + 22146 packets output, 2383680 bytes, 0 underruns | ||
95 | + 0 output errors, 0 collisions, 2 interface resets, 0 restarts | ||
96 | +POS4/0 is up, line protocol is up | ||
97 | + Hardware is Packet over SONET | ||
98 | + Internet address is 10.41.41.2/24 | ||
99 | + MTU 4470 bytes, BW 9952000 Kbit/sec, DLY 100 usec, rely 255/255, load 1/255 | ||
100 | + Encapsulation HDLC, crc 32, loopback not set | ||
101 | + Keepalive not set | ||
102 | + Scramble enabled | ||
103 | + Last input 00:00:59, output 00:00:11, output hang never | ||
104 | + Last clearing of "show interface" counters 00:00:14 | ||
105 | + Queueing strategy: fifo | ||
106 | + Output queue 0/40, 0 drops; input queue 0/75, 0 drops | ||
107 | + Available Bandwidth 9582482 kilobits/sec | ||
108 | + 5 minute input rate 0 bits/sec, 0 packets/sec | ||
109 | + 5 minute output rate 0 bits/sec, 0 packets/sec | ||
110 | + 0 packets input, 0 bytes, 0 no buffer | ||
111 | + Received 0 broadcasts, 0 runts, 0 giants, 0 throttles | ||
112 | + 0 parity | ||
113 | + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort | ||
114 | + 1 packets output, 314 bytes, 0 underruns | ||
115 | + 0 output errors, 0 applique, 0 interface resets | ||
116 | + 0 output buffer failures, 0 output buffers swapped out | ||
117 | + 0 carrier transitions | ||
118 | +Fddi5/0 is up, line protocol is up | ||
119 | + Hardware is cxBus Fddi, address is 0000.0c02.adf1 (bia 0000.0c02.adf1) | ||
120 | + Internet address is 10.108.33.14, subnet mask is 255.255.255.0 | ||
121 | + MTU 4470 bytes, BW 100000 Kbit/sec, DLY 100 usec, rely 255/255, load 1/255 | ||
122 | + Encapsulation SNAP, loopback not set, keepalive not set | ||
123 | + ARP type: SNAP, ARP Timeout 4:00:00 | ||
124 | + Phy-A state is active, neighbor is B, cmt signal bits 008/20C, status ILS | ||
125 | + Phy-B state is active, neighbor is A, cmt signal bits 20C/008, status ILS | ||
126 | + ECM is in, CFM is thru, RMT is ring_op | ||
127 | + Token rotation 5000 usec, ring operational 21:32:34 | ||
128 | + Upstream neighbor 0000.0c02.ba83, downstream neighbor 0000.0c02.ba83 | ||
129 | + Last input 0:00:05, output 0:00:00, output hang never | ||
130 | + Last clearing of “show interface” counters 0:59:10 | ||
131 | + Output queue 0/40, 0 drops; input queue 0/75, 0 drops | ||
132 | + 5 minute input rate 69000 bits/sec, 44 packets/sec | ||
133 | + 5 minute output rate 0 bits/sec, 1 packets/sec | ||
134 | + 113157 packets input, 21622582 bytes, 0 no buffer | ||
135 | + Received 276 broadcasts, 0 runts, 0 giants | ||
136 | + 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort | ||
137 | + 4740 packets output, 487346 bytes, 0 underruns | ||
138 | + 0 output errors, 0 collisions, 0 interface resets, 0 restarts | ||
139 | + 0 transitions, 2 traces, 3 claims, 2 beacons</response></item></cli-oper-data-block></data></rpc-reply>]]>]]> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?><rpc-reply message-id="7" xmlns="urn:ietf:params:netconf:base:1.0"><data><cli-oper-data-block><item><show>hardware</show><response> | ||
2 | + Cisco IOS Software, C3560E Software (C3560E-UNIVERSALK9-M), Version 15.0(2)EJ, RELEASE SOFTWARE (fc1) | ||
3 | + Technical Support: http://www.cisco.com/techsupport | ||
4 | + Copyright (c) 1986-2013 by Cisco Systems, Inc. | ||
5 | + Compiled Fri 13-Sep-13 12:09 by prod_rel_team | ||
6 | + ROM: Bootstrap program is C3560E boot loader | ||
7 | + BOOTLDR: C3560E Boot Loader (C3560X-HBOOT-M) Version 15.0(2r)EJ1, RELEASE SOFTWARE (fc1) | ||
8 | + switch01 uptime is 1 week, 3 days, 21 hours, 39 minutes | ||
9 | + System returned to ROM by power-on | ||
10 | + System restarted at 08:15:31 UTC Thu Apr 14 2016 | ||
11 | + System image file is "flash:/c3560e-universalk9-mz.150-2.EJ.bin" | ||
12 | + This product contains cryptographic features and is subject to United | ||
13 | + States and local country laws governing import, export, transfer and | ||
14 | + use. Delivery of Cisco cryptographic products does not imply | ||
15 | + third-party authority to import, export, distribute or use encryption. | ||
16 | + Importers, exporters, distributors and users are responsible for | ||
17 | + compliance with U.S. and local country laws. By using this product you | ||
18 | + agree to comply with applicable laws and regulations. If you are unable | ||
19 | + to comply with U.S. and local laws, return this product immediately. | ||
20 | + A summary of U.S. laws governing Cisco cryptographic products may be found at: | ||
21 | + http://www.cisco.com/wwl/export/crypto/tool/stqrg.html | ||
22 | + If you require further assistance please contact us by sending email to | ||
23 | + export@cisco.com. | ||
24 | + License Level: lanbase | ||
25 | + License Type: Permanent | ||
26 | + Next reload license Level: lanbase | ||
27 | + cisco SM-X-ES3-24-P (PowerPC405) processor with 262144K bytes of memory. | ||
28 | + Processor board ID FOC18401Z3R | ||
29 | + Last reset from power-on | ||
30 | + 2 Virtual Ethernet interfaces | ||
31 | + 26 Gigabit Ethernet interfaces | ||
32 | + The password-recovery mechanism is enabled. | ||
33 | + 512K bytes of flash-simulated non-volatile configuration memory. | ||
34 | + Base ethernet MAC Address : 68:99:CD:AA:2F:80 | ||
35 | + Model number : SM-X-ES3-24-P | ||
36 | + System serial number : FOC18401Z3R | ||
37 | + Hardware Board Revision Number : 0x00 | ||
38 | + Switch Ports Model SW Version SW Image | ||
39 | + ------ ----- ----- ---------- ---------- | ||
40 | + * 1 26 SM-X-ES3-24-P 15.0(2)EJ C3560E-UNIVERSALK9-M | ||
41 | +</response></item></cli-oper-data-block></data></rpc-reply>]]>]]> |
-
Please register or login to post a comment