Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 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.microsemi.yang; |
| 17 | |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 18 | import java.util.concurrent.CompletableFuture; |
| 19 | import java.util.concurrent.atomic.AtomicInteger; |
| 20 | import java.util.regex.Pattern; |
| 21 | |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 22 | import org.onosproject.netconf.DatastoreId; |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 23 | import org.onosproject.netconf.NetconfDeviceInfo; |
| 24 | import org.onosproject.netconf.NetconfDeviceOutputEventListener; |
| 25 | import org.onosproject.netconf.NetconfException; |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 26 | import org.onosproject.netconf.NetconfSessionAdapter; |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 27 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; |
| 29 | |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 30 | public class MockNetconfSessionEa1000 extends NetconfSessionAdapter { |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 31 | private static final Logger log = LoggerFactory |
| 32 | .getLogger(MockNetconfSessionEa1000.class); |
| 33 | |
| 34 | private static final String MESSAGE_ID_STRING = "message-id"; |
| 35 | private static final String EQUAL = "="; |
| 36 | private static final String RPC_OPEN = "<rpc "; |
| 37 | private static final String RPC_CLOSE = "</rpc>"; |
| 38 | private static final String GET_OPEN = "<get>"; |
| 39 | private static final String GET_CLOSE = "</get>"; |
| 40 | private static final String NEW_LINE = "\n"; |
| 41 | private static final String SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">"; |
| 42 | private static final String SUBTREE_FILTER_CLOSE = "</filter>"; |
| 43 | private static final String WITH_DEFAULT_OPEN = "<with-defaults "; |
| 44 | private static final String WITH_DEFAULT_CLOSE = "</with-defaults>"; |
| 45 | private static final String EDIT_CONFIG_OPEN = "<edit-config>"; |
| 46 | private static final String EDIT_CONFIG_CLOSE = "</edit-config>"; |
| 47 | private static final String TARGET_OPEN = "<target>"; |
| 48 | private static final String TARGET_CLOSE = "</target>"; |
| 49 | private static final String DEFAULT_OPERATION_OPEN = "<default-operation>"; |
| 50 | private static final String DEFAULT_OPERATION_CLOSE = "</default-operation>"; |
| 51 | private static final String CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"; |
| 52 | private static final String CONFIG_CLOSE = "</config>"; |
| 53 | |
| 54 | private static final String ENDPATTERN = "]]>]]>"; |
| 55 | private static final String XML_HEADER = |
| 56 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
| 57 | private static final String NETCONF_BASE_NAMESPACE = |
| 58 | "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\""; |
| 59 | private static final String NETCONF_WITH_DEFAULTS_NAMESPACE = |
| 60 | "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""; |
| 61 | |
| 62 | |
| 63 | private Pattern sampleXmlRegex1 = |
| 64 | Pattern.compile("(<\\?xml).*(<rpc).*(<get>).*(<filter).*" |
| 65 | + "(<system).*(<clock/>).*(</system>).*(</filter>)*.(</get>).*(</rpc).*(]]>){2}", |
| 66 | Pattern.DOTALL); |
| 67 | |
| 68 | private Pattern sampleXmlRegex2 = |
| 69 | Pattern.compile("(<\\?xml).*(<rpc).*(<get>).*(<filter).*(<system-state).*(</system-state>).*" |
| 70 | + "(<system).*(</system>).*(</filter>).*(</get>).*(</rpc).*(]]>){2}", |
| 71 | Pattern.DOTALL); |
| 72 | |
| 73 | private Pattern sampleXmlRegexSaFiltering = |
| 74 | Pattern.compile("(<\\?xml).*" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 75 | + "(<rpc).*(<get>)\\R?" |
| 76 | + "(<filter type=\"subtree\">)\\R?" |
| 77 | + "(<source-ipaddress-filtering).*(</source-ipaddress-filtering>)\\R?" |
| 78 | + "(</filter>)\\R?(</get>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 79 | |
| 80 | private Pattern sampleXmlRegexSaFilteringErrorScenario = |
| 81 | Pattern.compile("(<\\?xml).*" |
| 82 | + "(<rpc).*(<get>)\\R?" |
| 83 | + "(<filter type=\"subtree\">)\\R?" |
| 84 | + "(<source-ipaddress-filtering).*" |
| 85 | + "(<interface-eth0>)\\R?" |
| 86 | + "(<source-address-range>)\\R?" |
| 87 | + "(<range-id>)10(</range-id>)\\R?" |
| 88 | + "(</source-address-range>)\\R?" |
| 89 | + "(</interface-eth0>)\\R?" |
| 90 | + "(</source-ipaddress-filtering>)\\R?" |
| 91 | + "(</filter>)\\R?(</get>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 92 | |
| 93 | private Pattern sampleXmlRegexEditConfigSaFilt = |
| 94 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>).*" |
| 95 | + "(<target><running/></target>).*(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">).*" |
| 96 | + "(<source-ipaddress-filtering).*(<interface-eth0>).*" |
| 97 | + "(<source-address-range>).*(<range-id>).*(</range-id>).*" |
| 98 | + "(<name>).*(</name>).*(<ipv4-address-prefix>).*(</ipv4-address-prefix>).*" |
| 99 | + "(</source-address-range>).*(</interface-eth0>)*(</source-ipaddress-filtering>).*" |
| 100 | + "(</config>).*(</edit-config>).*(</rpc>).*(]]>){2}", Pattern.DOTALL); |
| 101 | |
| 102 | private Pattern sampleXmlRegexEditDeleteSaFilt = |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 103 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 104 | + "(<target><running/></target>)\\R?" |
| 105 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 106 | + "(<source-ipaddress-filtering " |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 107 | + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-sa-filtering\">)\\R?" |
| 108 | + "(<interface-eth0>)\\R?" |
| 109 | + "((<source-address-range nc:operation=\"delete\">)\\R?" |
| 110 | + "(<range-id>)[0-9]*(</range-id>)\\R?" |
| 111 | + "((<name>)[a-zA-Z0-9]*(</name>))?\\R?" |
| 112 | + "((<ipv4-address-prefix>)[0-9\\\\./]*(</ipv4-address-prefix>))?\\R?" |
| 113 | + "(</source-address-range>))++\\R?" |
| 114 | + "(</interface-eth0>)\\R?" |
| 115 | + "(</source-ipaddress-filtering>)\\R?" |
| 116 | + "(</config>)\\R?" |
| 117 | + "(</edit-config>)\\R?(</rpc>).*(]]>){2}", Pattern.DOTALL); |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 118 | |
| 119 | private Pattern sampleXmlRegexUniEvc = |
| 120 | Pattern.compile("(<\\?xml).*(<rpc).*(<get-config>)\\R?" |
| 121 | + "(<source>)\\R?(<running/>)\\R?(</source>)\\R?" |
| 122 | + "(<filter type=\"subtree\">)\\R?" |
| 123 | + "(<mef-services " |
| 124 | + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\"/>)\\R?" |
| 125 | + "(</filter>)\\R?(</get-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 126 | |
| 127 | private Pattern sampleXmlRegexUniEvcUni = |
| 128 | Pattern.compile("(<\\?xml).*(<rpc).*(<get-config>)\\R?" |
| 129 | + "(<source>)\\R?(<running/>)\\R?(</source>)\\R?" |
| 130 | + "(<filter type=\"subtree\">)\\R?" |
| 131 | + "(<mef-services " |
| 132 | + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">)\\R?" |
| 133 | + "(<uni/>)\\R?" |
| 134 | + "(</mef-services>)\\R?" |
| 135 | + "(</filter>)\\R?(</get-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 136 | |
| 137 | private Pattern sampleXmlRegexEditConfigUni1Evc = |
| 138 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 139 | + "(<target><running/></target>)\\R?" |
| 140 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 141 | + "(<mef-services).*(<uni>)\\R?(<name>).*(</name>)\\R?" |
| 142 | + "(<evc>)\\R?(<evc-index>).*(</evc-index>)\\R?(<name>).*(</name>)\\R?" |
| 143 | + "(<evc-per-uni>)\\R?" |
| 144 | + "(<evc-per-uni-c>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 145 | + "(<ce-vlan-map>)[0-9]*(</ce-vlan-map>)\\R?" |
| 146 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
| 147 | + "(<tag-push>)\\R?(<push-tag-type>)pushStag(</push-tag-type>)\\R?" |
| 148 | + "(<outer-tag-vlan>)[0-9]*(</outer-tag-vlan>)\\R?(</tag-push>)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 149 | + "((<flow-mapping>)\\R?" |
| 150 | + "(<ce-vlan-id>)[0-9]*(</ce-vlan-id>)\\R?" |
| 151 | + "(<flow-id>)[0-9]*(</flow-id>)\\R?" |
| 152 | + "(</flow-mapping>)\\R?)*" |
| 153 | + "(</evc-per-uni-c>)\\R?" |
| 154 | + "(<evc-per-uni-n>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 155 | + "(<ce-vlan-map>)[0-9\\:\\,]*(</ce-vlan-map>)\\R?" |
| 156 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 157 | + "(<tag-pop).*" |
| 158 | + "((<flow-mapping>)\\R?" |
| 159 | + "(<ce-vlan-id>)[0-9]*(</ce-vlan-id>)\\R?" |
| 160 | + "(<flow-id>)[0-9]*(</flow-id>)\\R?" |
| 161 | + "(</flow-mapping>)\\R?)*" |
| 162 | + "(</evc-per-uni-n>)\\R?" |
| 163 | + "(</evc-per-uni>)\\R?" |
| 164 | + "(</evc>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 165 | + "(</uni>)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 166 | + "(</mef-services>)\\R?" |
| 167 | + "(</config>)\\R?(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 168 | |
| 169 | private Pattern sampleXmlRegexEditConfigUni2Evc = |
| 170 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 171 | + "(<target><running/></target>)\\R?" |
| 172 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 173 | + "(<mef-services).*(<uni>)\\R?(<name>)[0-9a-zA-Z\\-\\:]*(</name>)\\R?" |
| 174 | + "(<evc>)\\R?(<evc-index>)[0-9]*(</evc-index>)\\R?(<name>)[0-9a-zA-Z\\-\\:]*(</name>)\\R?" |
| 175 | + "(<evc-per-uni>)\\R?" |
| 176 | + "(<evc-per-uni-c>)\\R?" |
| 177 | + "(<ce-vlan-map>)[0-9\\:\\,]*(</ce-vlan-map>)\\R?" |
| 178 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
| 179 | + "(</evc-per-uni-c>)\\R?" |
| 180 | + "(<evc-per-uni-n>)\\R?" |
| 181 | + "(<ce-vlan-map>)[0-9\\:\\,]*(</ce-vlan-map>)\\R?" |
| 182 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
| 183 | + "(<evc-per-uni-service-type>).*(</evc-per-uni-service-type>)\\R?" |
| 184 | + "(<tag-push>)\\R?(<push-tag-type>)pushStag(</push-tag-type>)\\R?(<outer-tag-vlan>).*" |
| 185 | + "(</outer-tag-vlan>)\\R?(</tag-push>)\\R?" |
| 186 | + "(</evc-per-uni-n>)\\R?" |
| 187 | + "(</evc-per-uni>)\\R?" |
| 188 | + "(</evc>)\\R?" |
| 189 | + "(<evc>)\\R?(<evc-index>)[0-9]*(</evc-index>)\\R?(<name>)[0-9a-zA-Z\\-\\:]*(</name>)\\R?" |
| 190 | + "(<evc-per-uni>)\\R?" |
| 191 | + "(<evc-per-uni-c>)\\R?" |
| 192 | + "(<ce-vlan-map>)[0-9\\:\\,]*(</ce-vlan-map>)\\R?" |
| 193 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
| 194 | + "(</evc-per-uni-c>)\\R?" |
| 195 | + "(<evc-per-uni-n>)\\R?" |
| 196 | + "(<ce-vlan-map>)[0-9\\:\\,]*(</ce-vlan-map>)\\R?" |
| 197 | + "(<ingress-bwp-group-index>)[0-9]*(</ingress-bwp-group-index>)\\R?" |
| 198 | + "(</evc-per-uni-n>)\\R?" |
| 199 | + "(</evc-per-uni>)\\R?" |
| 200 | + "(</evc>)\\R?(</uni>).*" |
| 201 | + "(</mef-services>)\\R?" |
| 202 | + "(</config>)\\R?(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 203 | |
| 204 | private Pattern sampleXmlRegexEditConfigUniProfiles = |
| 205 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>).*" |
| 206 | + "(<target><running/></target>).*(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">).*" |
| 207 | + "(<mef-services).*(<profiles>).*" |
| 208 | + "(<bwp-group>).*(<group-index>).*(</group-index>).*(</bwp-group>).*" |
| 209 | + "(<bwp-group>).*(<group-index>).*(</group-index>).*" |
| 210 | + "(<bwp>).*(<cos-index>).*(</cos-index>).*(<color-mode>).*(</color-mode>).*(</bwp>).*" |
| 211 | + "(<bwp>).*(<cos-index>).*(</cos-index>).*(<color-mode>).*(</color-mode>).*(</bwp>).*" |
| 212 | + "(</bwp-group>).*" |
| 213 | + "(</profiles>).*(</mef-services>).*" |
| 214 | + "(</config>).*(</edit-config>).*(</rpc>).*(]]>){2}", Pattern.DOTALL); |
| 215 | |
| 216 | private Pattern sampleXmlRegexEditConfigEvcDelete = |
| 217 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>).*" |
| 218 | + "(<target><running/></target>).*(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">).*" |
| 219 | + "(<mef-services).*" |
| 220 | + "(<uni>).*" |
| 221 | + "(<evc nc:operation=\"delete\">).*(<evc-index>).*(</evc-index>).*(</evc>).*" |
| 222 | + "(</uni>).*" |
| 223 | + "(</mef-services>).*" |
| 224 | + "(</config>).*(</edit-config>).*(</rpc>).*(]]>){2}", Pattern.DOTALL); |
| 225 | |
| 226 | private Pattern sampleXmlRegexGetConfigCeVlanMapsEvc = |
| 227 | Pattern.compile("(<\\?xml).*(<rpc).*(<get-config>)\\R?" |
| 228 | + "(<source>)\\R?(<running/>)\\R?(</source>)\\R?" |
| 229 | + "(<filter type=\"subtree\">)\\R?" |
| 230 | + "(<mef-services).*" |
| 231 | + "(<uni>)\\R?" |
| 232 | + "(<evc>)\\R?" |
| 233 | + "(<evc-index/>)\\R?" |
| 234 | + "(<evc-per-uni>)\\R?" |
| 235 | + "(<evc-per-uni-c><ce-vlan-map/><flow-mapping/><ingress-bwp-group-index/></evc-per-uni-c>)\\R?" |
| 236 | + "(<evc-per-uni-n><ce-vlan-map/><flow-mapping/><ingress-bwp-group-index/></evc-per-uni-n>)\\R?" |
| 237 | + "(</evc-per-uni>)\\R?" |
| 238 | + "(</evc>)\\R?" |
| 239 | + "(</uni>)\\R?" |
| 240 | + "(</mef-services>)\\R?" |
| 241 | + "(</filter>)\\R?" |
| 242 | + "(</get-config>)\\R?" |
| 243 | + "(</rpc>)\\R?" |
| 244 | + "(]]>){2}", Pattern.DOTALL); |
| 245 | |
| 246 | //For test testRemoveEvcUniFlowEntries() |
| 247 | private Pattern sampleXmlRegexEditConfigCeVlanMapReplace = |
| 248 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>).*" |
| 249 | + "(<target><running/></target>).*" |
| 250 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">).*" |
| 251 | + "(<mef-services xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">).*" |
| 252 | + "(<uni>).*" |
| 253 | + "(<evc nc:operation=\"delete\">).*(<evc-index>.*</evc-index>).*(</evc>).*" |
| 254 | + "(<evc nc:operation=\"delete\">).*(<evc-index>.*</evc-index>).*(</evc>).*" |
| 255 | + "(<evc>).*(<evc-index>).*(</evc-index>).*(<evc-per-uni>).*" |
| 256 | + "(<evc-per-uni-c>).*" |
| 257 | + "(<ce-vlan-map nc:operation=\"replace\">).*(</ce-vlan-map>).*" |
| 258 | + "(<flow-mapping nc:operation=\"delete\">).*(<ce-vlan-id>).*(</ce-vlan-id>).*(</flow-mapping>).*" |
| 259 | + "(</evc-per-uni-c>).*" |
| 260 | + "(<evc-per-uni-n>).*" |
| 261 | + "(<ce-vlan-map nc:operation=\"replace\">).*(</ce-vlan-map>).*" |
| 262 | + "(<flow-mapping nc:operation=\"delete\">).*(<ce-vlan-id>).*(</ce-vlan-id>).*(</flow-mapping>).*" |
| 263 | + "(</evc-per-uni-n>).*" |
| 264 | + "(</evc-per-uni>).*(</evc>).*" |
| 265 | + "(<evc>).*(<evc-index>).*(</evc-index>).*(<evc-per-uni>).*" |
| 266 | + "(<evc-per-uni-c>).*" |
| 267 | + "(<ce-vlan-map nc:operation=\"replace\">).*(</ce-vlan-map>).*" |
| 268 | + "(<flow-mapping nc:operation=\"delete\">).*(<ce-vlan-id>).*(</ce-vlan-id>).*(</flow-mapping>).*" |
| 269 | + "(</evc-per-uni-c>).*" |
| 270 | + "(<evc-per-uni-n>).*" |
| 271 | + "(<ce-vlan-map nc:operation=\"replace\">).*(</ce-vlan-map>).*" |
| 272 | + "(<flow-mapping nc:operation=\"delete\">).*(<ce-vlan-id>).*(</ce-vlan-id>).*(</flow-mapping>).*" |
| 273 | + "(</evc-per-uni-n>).*" |
| 274 | + "(</evc-per-uni>).*(</evc>).*" |
| 275 | + "(</uni>).*(</mef-services>).*" |
| 276 | + "(</config>).*(</edit-config>).*(</rpc>).*(]]>){2}", Pattern.DOTALL); |
| 277 | |
| 278 | |
| 279 | //For testPerformMeterOperationDeviceIdMeterAdd() |
| 280 | private Pattern sampleXmlRegexEditConfigBwpGroup1 = |
| 281 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 282 | + "(<target>\\R?<running/>\\R?</target>)\\R?" |
| 283 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 284 | + "(<mef-services " |
| 285 | + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">)\\R?" |
| 286 | + "(<profiles>)\\R?" |
| 287 | + "(<bwp-group>)\\R?" |
| 288 | + "(<group-index>)[0-9]*(</group-index>)\\R?" |
| 289 | + "(<bwp>)\\R?" |
| 290 | + "(<cos-index>)[0-9]*(</cos-index>)\\R?" |
| 291 | + "(<name>).*(</name>)\\R?" |
| 292 | + "(<committed-information-rate>)[0-9]*(</committed-information-rate>)\\R?" |
| 293 | + "(<committed-burst-size>)[0-9]*(</committed-burst-size>)\\R?" |
| 294 | + "(<excess-information-rate>)[0-9]*(</excess-information-rate>)\\R?" |
| 295 | + "(<excess-burst-size>)[0-9]*(</excess-burst-size>)\\R?" |
| 296 | + "(</bwp>)\\R?" |
| 297 | + "(</bwp-group>)\\R?" |
| 298 | + "(<cos>)\\R?" |
| 299 | + "(<cos-index>)[0-9](</cos-index>)\\R?" |
| 300 | + "(<name>).*(</name>)\\R?" |
| 301 | + "(<outgoing-cos-value>)[0-9]*(</outgoing-cos-value>)\\R?" |
| 302 | + "(<color-aware>true</color-aware>)\\R?" |
| 303 | + "(<color-forward>true</color-forward>)\\R?" |
| 304 | + "(<evc-cos-type-all-8-prio-to-1-evc-color>)\\R?" |
| 305 | + "(<evc-all-8-color-to>green</evc-all-8-color-to>)\\R?" |
| 306 | + "(</evc-cos-type-all-8-prio-to-1-evc-color>)\\R?" |
| 307 | + "(</cos>)\\R?" |
| 308 | + "(</profiles>)\\R?" |
| 309 | + "(</mef-services>)\\R?" |
| 310 | + "(</config>)\\R?(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 311 | |
| 312 | //For testPerformMeterOperationDeviceIdMeterRemove() |
| 313 | private Pattern sampleXmlRegexEditConfigBwpGroup1Delete = |
| 314 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 315 | + "(<target>\\R?<running/>\\R?</target>)\\R?" |
| 316 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 317 | + "(<mef-services xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">)\\R?" |
| 318 | + "(<profiles>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 319 | + "((<bwp-group nc:operation=\"delete\">)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 320 | + "(<group-index>)[0-9]*(</group-index>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 321 | + "(<bwp>.*</bwp>)?" |
| 322 | + "(</bwp-group>))++\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 323 | + "(</profiles>)\\R?" |
| 324 | + "(</mef-services>)\\R?" |
| 325 | + "(</config>)\\R?(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 326 | |
| 327 | private Pattern sampleXmlRegexSetCurrentDatetime = |
| 328 | Pattern.compile("(<\\?xml).*(<rpc).*" |
| 329 | + "(<set-current-datetime xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\">)\\R?" |
| 330 | + "(<current-datetime>)" |
| 331 | + "[0-9]{4}-[0-9]{2}-[0-9]{2}(T)[0-9]{2}:[0-9]{2}:[0-9]{2}[+-][0-9]{2}:[0-9]{2}" |
| 332 | + "(</current-datetime>)\\R?" |
| 333 | + "(</set-current-datetime>)\\R?" |
| 334 | + "(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 335 | |
| 336 | //For testGetConfigMseaCfmEssentials |
| 337 | private Pattern sampleXmlRegexGetMseaCfmEssentials = |
| 338 | Pattern.compile("(<\\?xml).*(<rpc).*(<get>)\\R?" |
| 339 | + "(<filter type=\"subtree\">)\\R?" |
| 340 | + "(<mef-cfm).*" |
| 341 | + "(<maintenance-domain>)\\R?" |
| 342 | + "(<id/>)\\R?" |
| 343 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 344 | + "(<md-level/>)?\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 345 | + "(<maintenance-association>)\\R?" |
| 346 | + "(<id/>)\\R?" |
| 347 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 348 | + "(<ccm-interval>)[0-9]{1,3}(ms</ccm-interval>)\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 349 | + "(<remote-meps/>)\\R?" |
| 350 | + "(<component-list/>)\\R?" |
| 351 | + "(<maintenance-association-end-point>)\\R?" |
| 352 | + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 353 | + "(<mac-address/>)?\\R?" |
| 354 | + "((<remote-mep-database>)\\R?" |
| 355 | + "(<remote-mep>)\\R?" |
| 356 | + "(<remote-mep-id/>)\\R?" |
| 357 | + "(</remote-mep>)\\R?" |
| 358 | + "(</remote-mep-database>))?\\R?" |
| 359 | + "((<msea-soam-pm:delay-measurements>)\\R?" |
| 360 | + "(<msea-soam-pm:delay-measurement>)\\R?" |
| 361 | + "((<msea-soam-pm:dm-id/>)|(<msea-soam-pm:dm-id>[0-9]*</msea-soam-pm:dm-id>))\\R?" |
| 362 | + "(</msea-soam-pm:delay-measurement>)\\R?" |
| 363 | + "(</msea-soam-pm:delay-measurements>))?\\R?" |
| 364 | + "((<msea-soam-pm:loss-measurements>)\\R?" |
| 365 | + "(<msea-soam-pm:loss-measurement>)\\R?" |
| 366 | + "((<msea-soam-pm:lm-id/>)|(<msea-soam-pm:lm-id>[0-9]*</msea-soam-pm:lm-id>))\\R?" |
| 367 | + "(</msea-soam-pm:loss-measurement>)\\R?" |
| 368 | + "(</msea-soam-pm:loss-measurements>))?\\R?" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 369 | + "(</maintenance-association-end-point>)\\R?" |
| 370 | + "(</maintenance-association>)\\R?" |
| 371 | + "(</maintenance-domain>)\\R?" |
| 372 | + "(</mef-cfm>)\\R?" |
| 373 | + "(</filter>)\\R?" |
| 374 | + "(</get>)\\R?" |
| 375 | + "(</rpc>)\\R?" |
| 376 | + "(]]>){2}", Pattern.DOTALL); |
| 377 | |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 378 | //For testGetConfigMseaCfmEssentials |
| 379 | private Pattern sampleXmlRegexGetMseaCfmFull = |
| 380 | Pattern.compile("(<\\?xml).*(<rpc).*(<get>)\\R?" |
| 381 | + "(<filter type=\"subtree\">)\\R?" |
| 382 | + "(<mef-cfm).*" |
| 383 | + "(<maintenance-domain>)\\R?" |
| 384 | + "(<id/>)\\R?" |
| 385 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 386 | + "(<md-level/>)?\\R?" |
| 387 | + "(<maintenance-association>)\\R?" |
| 388 | + "(<id/>)\\R?" |
| 389 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 390 | + "(<maintenance-association-end-point>)\\R?" |
| 391 | + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?" |
| 392 | + "(<interface/>)?\\R?" |
| 393 | + "(<primary-vid/>)?\\R?" |
| 394 | + "(<administrative-state/>)?\\R?" |
| 395 | + "(<mac-address/>)?\\R?" |
| 396 | + "(<ccm-ltm-priority/>)?\\R?" |
| 397 | + "(<continuity-check/>)?\\R?" |
| 398 | + "(<loopback/>)?\\R?" |
| 399 | + "(<linktrace/>)?\\R?" |
| 400 | + "(<remote-mep-database/>)\\R?" |
| 401 | + "(<msea-soam-fm:operational-state/>)\\R?" |
| 402 | + "(<msea-soam-fm:connectivity-status/>)\\R?" |
| 403 | + "(<msea-soam-fm:port-status/>)\\R?" |
| 404 | + "(<msea-soam-fm:interface-status/>)\\R?" |
| 405 | + "(<msea-soam-fm:last-defect-sent/>)\\R?" |
| 406 | + "(<msea-soam-fm:rdi-transmit-status/>)\\R?" |
| 407 | + "(</maintenance-association-end-point>)\\R?" |
| 408 | + "(</maintenance-association>)\\R?" |
| 409 | + "(</maintenance-domain>)\\R?" |
| 410 | + "(</mef-cfm>)\\R?" |
| 411 | + "(</filter>)\\R?" |
| 412 | + "(</get>)\\R?" |
| 413 | + "(</rpc>)\\R?" |
| 414 | + "(]]>){2}", Pattern.DOTALL); |
| 415 | |
| 416 | //For testGetConfigMseaCfmEssentials |
| 417 | private Pattern sampleXmlRegexGetMseaDelay = |
| 418 | Pattern.compile("(<\\?xml).*(<rpc).*(<get>)\\R?" |
| 419 | + "(<filter type=\"subtree\">)\\R?" |
| 420 | + "(<mef-cfm).*" |
| 421 | + "(<maintenance-domain>)\\R?" |
| 422 | + "(<id/>)\\R?" |
| 423 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 424 | + "(<maintenance-association>)\\R?" |
| 425 | + "(<id/>)\\R?" |
| 426 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 427 | + "(<maintenance-association-end-point>)\\R?" |
| 428 | + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?" |
| 429 | + "((<msea-soam-pm:delay-measurements>)\\R?" |
| 430 | + "(<msea-soam-pm:delay-measurement>)\\R?" |
| 431 | + "((<msea-soam-pm:dm-id/>)|(<msea-soam-pm:dm-id>[0-9]*</msea-soam-pm:dm-id>))\\R?" |
| 432 | + "(<msea-soam-pm:mep-id/>)\\R?" |
| 433 | + "(<msea-soam-pm:mac-address/>)\\R?" |
| 434 | + "(<msea-soam-pm:administrative-state/>)\\R?" |
| 435 | + "(<msea-soam-pm:measurement-enable/>)\\R?" |
| 436 | + "(<msea-soam-pm:message-period/>)\\R?" |
| 437 | + "(<msea-soam-pm:priority/>)\\R?" |
| 438 | + "(<msea-soam-pm:frame-size/>)\\R?" |
| 439 | + "(<msea-soam-pm:measurement-interval/>)\\R?" |
| 440 | + "(<msea-soam-pm:number-intervals-stored/>)\\R?" |
| 441 | + "(<msea-soam-pm:session-status/>)\\R?" |
| 442 | + "(<msea-soam-pm:frame-delay-two-way/>)\\R?" |
| 443 | + "(<msea-soam-pm:inter-frame-delay-variation-two-way/>)\\R?" |
| 444 | + "(<msea-soam-pm:current-stats/>)?\\R?" |
| 445 | + "(<msea-soam-pm:history-stats/>)?\\R?" |
| 446 | + "(</msea-soam-pm:delay-measurement>)\\R?" |
| 447 | + "(</msea-soam-pm:delay-measurements>))?\\R?" |
| 448 | + "(</maintenance-association-end-point>)\\R?" |
| 449 | + "(</maintenance-association>)\\R?" |
| 450 | + "(</maintenance-domain>)\\R?" |
| 451 | + "(</mef-cfm>)\\R?" |
| 452 | + "(</filter>)\\R?" |
| 453 | + "(</get>)\\R?" |
| 454 | + "(</rpc>)\\R?" |
| 455 | + "(]]>){2}", Pattern.DOTALL); |
| 456 | |
| 457 | //For testGetConfigMseaCfmEssentials |
| 458 | private Pattern sampleXmlRegexDeleteMseaCfmMep = |
| 459 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 460 | + "(<target>\\R?<running/>\\R?</target>)\\R?" |
| 461 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 462 | + "(<mef-cfm).*" |
| 463 | + "(<maintenance-domain>)\\R?" |
| 464 | + "(<id/>)?\\R?" |
| 465 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 466 | + "(<maintenance-association>)\\R?" |
| 467 | + "(<id/>)?\\R?" |
| 468 | + "(<name>)([a-zA-Z0-9\\-:\\.]){1,48}(</name>)\\R?" |
| 469 | + "(<maintenance-association-end-point nc:operation=\"delete\">)\\R?" |
| 470 | + "(<mep-identifier>)[0-9]{1,4}(</mep-identifier>)\\R?" |
| 471 | + "(</maintenance-association-end-point>)\\R?" |
| 472 | + "(</maintenance-association>)\\R?" |
| 473 | + "(</maintenance-domain>)\\R?" |
| 474 | + "(</mef-cfm>)\\R?" |
| 475 | + "(</config>)\\R?" |
| 476 | + "(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 477 | |
| 478 | |
| 479 | private Pattern sampleXmlRegexTransmitLoopback = |
| 480 | Pattern.compile("(<\\?xml).*(<rpc).*\\R?" |
| 481 | + "(<transmit-loopback xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?" |
| 482 | + "((<number-of-messages>)[0-9]*(</number-of-messages>))?\\R?" |
| 483 | + "((<data-tlv>)[a-zA-Z0-9+=/]*(</data-tlv>))?\\R?" |
| 484 | + "((<vlan-priority>)[0-9]{1}(</vlan-priority>))?\\R?" |
| 485 | + "((<vlan-drop-eligible>)((true)|(false))(</vlan-drop-eligible>))?\\R?" |
| 486 | + "(<maintenance-association-end-point>)[0-9]{1,4}(</maintenance-association-end-point>)\\R?" |
| 487 | + "(<maintenance-association>)[0-9]{1,5}(</maintenance-association>)\\R?" |
| 488 | + "(<maintenance-domain>)[0-9]{1,5}(</maintenance-domain>)\\R?" |
| 489 | + "(<target-address>)\\R?" |
| 490 | + "((<mep-id>)[0-9]{1,4}(</mep-id>))?\\R?" |
| 491 | + "((<mac-address>)[a-fA-F0-9:-]{17}(</mac-address>))?\\R?" |
| 492 | + "(</target-address>)\\R?" |
| 493 | + "(</transmit-loopback>)\\R?" |
| 494 | + "(</rpc>)\\R?" |
| 495 | + "(]]>){2}", Pattern.DOTALL); |
| 496 | |
| 497 | private Pattern sampleXmlRegexAbortLoopback = |
| 498 | Pattern.compile("(<\\?xml).*(<rpc).*\\R?" |
| 499 | + "(<abort-loopback xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?" |
| 500 | + "(<maintenance-association-end-point>)[0-9]{1,4}(</maintenance-association-end-point>)\\R?" |
| 501 | + "(<maintenance-association>)[0-9]{1,5}(</maintenance-association>)\\R?" |
| 502 | + "(<maintenance-domain>)[0-9]{1,5}(</maintenance-domain>)\\R?" |
| 503 | + "(</abort-loopback>)\\R?" |
| 504 | + "(</rpc>)\\R?" |
| 505 | + "(]]>){2}", Pattern.DOTALL); |
| 506 | |
| 507 | //For testCreateDm() |
| 508 | private Pattern sampleXmlRegexEditConfigDmCreate = |
| 509 | Pattern.compile("(<\\?xml).*(<rpc).*(<edit-config>)\\R?" |
| 510 | + "(<target>\\R?<running/>\\R?</target>)\\R?" |
| 511 | + "(<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">)\\R?" |
| 512 | + "(<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\">)\\R?" |
| 513 | + "(<maintenance-domain>)\\R?" |
| 514 | + "(<id>)[0-9]*(</id>)\\R?" |
| 515 | + "(<maintenance-association>)\\R?" |
| 516 | + "(<id>)[0-9]*(</id>)\\R?" |
| 517 | + "(<maintenance-association-end-point>)\\R?" |
| 518 | + "(<mep-identifier>)[0-9]*(</mep-identifier>)\\R?" |
| 519 | + "(<delay-measurements xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">)\\R?" |
| 520 | + "(<delay-measurement>)\\R?" |
| 521 | + "(<dm-id>)[0-9]*(</dm-id>)\\R?" |
| 522 | + "((<administrative-state>)(true|false)(</administrative-state>))?\\R?" |
| 523 | + "((<message-period>)(1000ms|100ms|10ms|3ms)(</message-period>))?\\R?" |
| 524 | + "(<priority>)[0-9]*(</priority>)\\R?" |
| 525 | + "((<frame-size>)[0-9]*(</frame-size>))?\\R?" |
| 526 | + "(<mep-id>)[0-9]*(</mep-id>)\\R?" |
| 527 | + "(</delay-measurement>)\\R?" |
| 528 | + "(</delay-measurements>)\\R?" |
| 529 | + "(</maintenance-association-end-point>)\\R?" |
| 530 | + "(</maintenance-association>)\\R?" |
| 531 | + "(</maintenance-domain>)\\R?" |
| 532 | + "(</mef-cfm>)\\R?" |
| 533 | + "(</config>)\\R?" |
| 534 | + "(</edit-config>)\\R?(</rpc>)\\R?(]]>){2}", Pattern.DOTALL); |
| 535 | |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 536 | |
| 537 | private static final String SAMPLE_SYSTEM_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 538 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 539 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 540 | + "<system xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\">\n" |
| 541 | + "<clock><timezone-name>Etc/UTC</timezone-name></clock>\n" |
| 542 | + "</system>\n" |
| 543 | + "</data>\n" |
| 544 | + "</rpc-reply>"; |
| 545 | |
| 546 | private static final String SAMPLE_SYSTEM_REPLY_INIT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 547 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">" |
| 548 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 549 | + "<system xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\">\n" |
| 550 | + "<longitude xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-system\">-8.4683990</longitude>\n" |
| 551 | + "<latitude xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-system\">51.9036140</latitude>\n" |
| 552 | + "</system>\n" |
| 553 | + "<system-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-system\"" |
| 554 | + " xmlns:sysms=\"http://www.microsemi.com/microsemi-edge-assure/msea-system\">\n" |
| 555 | + "<platform>\n" |
| 556 | + "<os-release>4.4.0-53-generic</os-release>\n" |
| 557 | + "<sysms:device-identification>\n" |
| 558 | + "<sysms:serial-number>Eagle Simulator.</sysms:serial-number>\n" |
| 559 | + "</sysms:device-identification>\n" |
| 560 | + "</platform>\n" |
| 561 | + "</system-state>\n" |
| 562 | + "</data>" |
| 563 | + "</rpc-reply>"; |
| 564 | |
| 565 | private static final String SAMPLE_MSEASAFILTERING_FE_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 566 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 567 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 568 | + "<source-ipaddress-filtering " |
| 569 | + "xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-sa-filtering\">\n" |
| 570 | + "<interface-eth0>\n" |
| 571 | + "<filter-admin-state>inactive</filter-admin-state>\n" |
| 572 | + "<source-address-range>\n" |
| 573 | + "<range-id>1</range-id>\n" |
| 574 | + "<ipv4-address-prefix>10.10.10.10/16</ipv4-address-prefix>\n" |
| 575 | + "<name>Filter1</name>\n" |
| 576 | + "</source-address-range>\n" |
| 577 | + "<source-address-range>\n" |
| 578 | + "<range-id>2</range-id>\n" |
| 579 | + "<ipv4-address-prefix>20.30.40.50/18</ipv4-address-prefix>\n" |
| 580 | + "<name>Flow:5e0000abaa2772</name>\n" |
| 581 | + "</source-address-range>\n" |
| 582 | + "</interface-eth0>\n" |
| 583 | + "</source-ipaddress-filtering>\n" |
| 584 | + "</data>\n" |
| 585 | + "</rpc-reply>"; |
| 586 | |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 587 | private static final String SAMPLE_ERROR_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 588 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 589 | + "<rpc-error>" |
| 590 | + "<error-type>application</error-type>" |
| 591 | + "<error-tag>data-missing</error-tag>" |
| 592 | + "<error-severity>error</error-severity>" |
| 593 | + "<error-message>Request could not be completed because " + |
| 594 | "the relevant data model content does not exist.</error-message>" |
| 595 | + "</rpc-error>" |
| 596 | + "</rpc-reply>"; |
| 597 | |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 598 | private static final String SAMPLE_MSEAEVCUNI_REPLY_INIT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 599 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 600 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 601 | + "<mef-services xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\"/>" |
| 602 | + "</data>\n" |
| 603 | + "</rpc-reply>"; |
| 604 | |
| 605 | private static final String SAMPLE_MSEAEVCUNI_FE_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 606 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 607 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 608 | + "<mef-services xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">\n" |
| 609 | + "<uni>\n" |
| 610 | + "<name>Flow:7557655abfecd57865</name>\n" |
| 611 | + "<evc>\n" |
| 612 | + "<evc-index>7</evc-index\n>" |
| 613 | + "<name>evc-7</name>\n" |
| 614 | + "<evc-per-uni>\n" |
| 615 | + "<evc-per-uni-c>\n" |
| 616 | + "<ce-vlan-map>10</ce-vlan-map>\n" |
| 617 | + "<ingress-bwp-group-index>1</ingress-bwp-group-index>\n" |
| 618 | + "<tag-push>\n" |
| 619 | + "<push-tag-type>pushStag</push-tag-type>\n" |
| 620 | + "<outer-tag-vlan>3</outer-tag-vlan>\n" |
| 621 | + "</tag-push>\n" |
| 622 | + "<flow-mapping>\n" |
| 623 | + "<ce-vlan-id>10</ce-vlan-id>\n" |
| 624 | + "<flow-id>27021600672053710</flow-id>\n" |
| 625 | + "</flow-mapping>\n" |
| 626 | + "<evc-per-uni-service-type>epl</evc-per-uni-service-type>\n" |
| 627 | + "</evc-per-uni-c>\n" |
| 628 | + "<evc-per-uni-n>\n" |
| 629 | + "<ce-vlan-map>11</ce-vlan-map>\n" |
| 630 | + "<ingress-bwp-group-index>0</ingress-bwp-group-index>\n" |
| 631 | + "<flow-mapping>\n" |
| 632 | + "<ce-vlan-id>11</ce-vlan-id>\n" |
| 633 | + "<flow-id>27021600672053711</flow-id>\n" |
| 634 | + "</flow-mapping>\n" |
| 635 | + "</evc-per-uni-n>\n" |
| 636 | + "</evc-per-uni>\n" |
| 637 | + "<uni-evc-id>EA1000-Uni-from-ONOS_5</uni-evc-id>\n" |
| 638 | + "<evc-status>\n" |
| 639 | + "<operational-state>unknown</operational-state>\n" |
| 640 | + "<max-mtu-size>9600</max-mtu-size>\n" |
| 641 | + "<max-num-uni>2</max-num-uni>\n" |
| 642 | + "</evc-status>\n" |
| 643 | + "</evc>\n" |
| 644 | + "<evc>\n" |
| 645 | + "<evc-index>8</evc-index>\n" |
| 646 | + "<name>evc-8</name>\n" |
| 647 | + "<evc-per-uni>\n" |
| 648 | + "<evc-per-uni-c>\n" |
| 649 | + "<ce-vlan-map>12:14,20:22,25</ce-vlan-map>\n" |
| 650 | + "<ingress-bwp-group-index>0</ingress-bwp-group-index>\n" |
| 651 | + "<tag-pop />\n" |
| 652 | + "<evc-per-uni-service-type>epl</evc-per-uni-service-type>\n" |
| 653 | + "<flow-mapping>\n" |
| 654 | + "<ce-vlan-id>12</ce-vlan-id>\n" |
| 655 | + "<flow-id>27021600672053712</flow-id>\n" |
| 656 | + "</flow-mapping>\n" |
| 657 | + "<flow-mapping>\n" |
| 658 | + "<ce-vlan-id>13</ce-vlan-id>\n" |
| 659 | + "<flow-id>27021600672053713</flow-id>\n" |
| 660 | + "</flow-mapping>\n" |
| 661 | + "<flow-mapping>\n" |
| 662 | + "<ce-vlan-id>14</ce-vlan-id>\n" |
| 663 | + "<flow-id>27021600672053714</flow-id>\n" |
| 664 | + "</flow-mapping>\n" |
| 665 | + "<flow-mapping>\n" |
| 666 | + "<ce-vlan-id>20</ce-vlan-id>\n" |
| 667 | + "<flow-id>27021600672053720</flow-id>\n" |
| 668 | + "</flow-mapping>\n" |
| 669 | + "<flow-mapping>\n" |
| 670 | + "<ce-vlan-id>21</ce-vlan-id>\n" |
| 671 | + "<flow-id>27021600672053721</flow-id>\n" |
| 672 | + "</flow-mapping>\n" |
| 673 | + "<flow-mapping>\n" |
| 674 | + "<ce-vlan-id>22</ce-vlan-id>\n" |
| 675 | + "<flow-id>27021600672053722</flow-id>\n" |
| 676 | + "</flow-mapping>\n" |
| 677 | + "<flow-mapping>\n" |
| 678 | + "<ce-vlan-id>25</ce-vlan-id>\n" |
| 679 | + "<flow-id>27021600672053725</flow-id>\n" |
| 680 | + "</flow-mapping>\n" |
| 681 | + "</evc-per-uni-c>\n" |
| 682 | + "<evc-per-uni-n>\n" |
| 683 | + "<ce-vlan-map>13</ce-vlan-map>\n" |
| 684 | + "<ingress-bwp-group-index>0</ingress-bwp-group-index>\n" |
| 685 | + "<flow-mapping>\n" |
| 686 | + "<ce-vlan-id>13</ce-vlan-id>\n" |
| 687 | + "<flow-id>27021600672053713</flow-id>\n" |
| 688 | + "</flow-mapping>\n" |
| 689 | + "</evc-per-uni-n>\n" |
| 690 | + "</evc-per-uni>\n" |
| 691 | + "<uni-evc-id>EA1000-Uni-from-ONOS_5</uni-evc-id>\n" |
| 692 | + "<evc-status>\n" |
| 693 | + "<operational-state>unknown</operational-state>\n" |
| 694 | + "<max-mtu-size>9600</max-mtu-size>\n" |
| 695 | + "<max-num-uni>2</max-num-uni>\n" |
| 696 | + "</evc-status>\n" |
| 697 | + "</evc>\n" |
| 698 | + "</uni>\n" |
| 699 | + "<profiles>\n" |
| 700 | + "<bwp-group>\n" |
| 701 | + "<group-index>0</group-index>\n" |
| 702 | + "</bwp-group>\n" |
| 703 | + "</profiles>\n" |
| 704 | + "</mef-services>\n" |
| 705 | + "</data>\n" |
| 706 | + "</rpc-reply>"; |
| 707 | |
| 708 | private static final String SAMPLE_MSEAEVCUNI_CEVLANMAP_EVC_REPLY = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 709 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"1\">\n" |
| 710 | + "<data xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" |
| 711 | + "<mef-services xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-uni-evc-service\">\n" |
| 712 | + "<uni>\n" |
| 713 | |
| 714 | + "<evc><evc-index>1</evc-index>\n" |
| 715 | + "<evc-per-uni>\n" |
| 716 | + "<evc-per-uni-c>\n" |
| 717 | + "<ce-vlan-map>101</ce-vlan-map>\n" |
| 718 | + "<flow-mapping>\n" |
| 719 | + "<ce-vlan-id>101</ce-vlan-id>\n" |
| 720 | + "<flow-id>27021598629213101</flow-id>\n" |
| 721 | + "</flow-mapping>\n" |
| 722 | + "</evc-per-uni-c>\n" |
| 723 | + "<evc-per-uni-n>\n" |
| 724 | + "<ce-vlan-map>102</ce-vlan-map>\n" |
| 725 | + "<flow-mapping>\n" |
| 726 | + "<ce-vlan-id>102</ce-vlan-id>\n" |
| 727 | + "<flow-id>27021598629213102</flow-id>\n" |
| 728 | + "</flow-mapping>\n" |
| 729 | + "</evc-per-uni-n>\n" |
| 730 | + "</evc-per-uni>\n" |
| 731 | + "</evc>\n" |
| 732 | |
| 733 | + "<evc><evc-index>7</evc-index>\n" |
| 734 | + "<evc-per-uni>\n" |
| 735 | + "<evc-per-uni-c>\n" |
| 736 | + "<ce-vlan-map>700,710,720</ce-vlan-map>\n" |
| 737 | + "<flow-mapping>\n" |
| 738 | + "<ce-vlan-id>700</ce-vlan-id>\n" |
| 739 | + "<flow-id>27021598629213700</flow-id>\n" |
| 740 | + "</flow-mapping>\n" |
| 741 | + "<flow-mapping>\n" |
| 742 | + "<ce-vlan-id>710</ce-vlan-id>\n" |
| 743 | + "<flow-id>27021598629213710</flow-id>\n" |
| 744 | + "</flow-mapping>\n" |
| 745 | + "<flow-mapping>\n" |
| 746 | + "<ce-vlan-id>720</ce-vlan-id>\n" |
| 747 | + "<flow-id>27021598629213720</flow-id>\n" |
| 748 | + "</flow-mapping>\n" |
| 749 | + "</evc-per-uni-c>\n" |
| 750 | + "<evc-per-uni-n>\n" |
| 751 | + "<ce-vlan-map>701:703</ce-vlan-map>\n" |
| 752 | + "<flow-mapping>\n" |
| 753 | + "<ce-vlan-id>701</ce-vlan-id>\n" |
| 754 | + "<flow-id>27021598629213701</flow-id>\n" |
| 755 | + "</flow-mapping>\n" |
| 756 | + "<flow-mapping>\n" |
| 757 | + "<ce-vlan-id>702</ce-vlan-id>\n" |
| 758 | + "<flow-id>27021598629213702</flow-id>\n" |
| 759 | + "</flow-mapping>\n" |
| 760 | + "<flow-mapping>\n" |
| 761 | + "<ce-vlan-id>703</ce-vlan-id>\n" |
| 762 | + "<flow-id>27021598629213703</flow-id>\n" |
| 763 | + "</flow-mapping>\n" |
| 764 | + "</evc-per-uni-n>\n" |
| 765 | + "</evc-per-uni>\n" |
| 766 | + "</evc>\n" |
| 767 | |
| 768 | + "<evc><evc-index>8</evc-index>\n" |
| 769 | + "<evc-per-uni>\n" |
| 770 | + "<evc-per-uni-c>\n<ce-vlan-map>800,810,820</ce-vlan-map>\n</evc-per-uni-c>\n" |
| 771 | + "<evc-per-uni-n>\n<ce-vlan-map>801:803</ce-vlan-map>\n</evc-per-uni-n>\n" |
| 772 | + "</evc-per-uni>\n" |
| 773 | + "</evc>\n" |
| 774 | |
| 775 | + "</uni>\n" |
| 776 | + "</mef-services>\n" |
| 777 | + "</data>\n" |
| 778 | + "</rpc-reply>"; |
| 779 | |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 780 | private static final String SAMPLE_MSEACFM_MD_MA_MEP_ESSENTIALS_REPLY = |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 781 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 782 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">" |
| 783 | + "<data>" |
| 784 | + "<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" " |
| 785 | + "xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" " |
| 786 | + "xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">" |
| 787 | + "<maintenance-domain>" |
| 788 | + "<id>1</id>" |
| 789 | + "<name>md-1</name>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 790 | + "<maintenance-association>" |
| 791 | + "<id>1</id>" |
| 792 | + "<name>ma-1-1</name>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 793 | + "<maintenance-association-end-point>" |
| 794 | + "<mep-identifier>1</mep-identifier>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 795 | + "<mac-address>00:b0:ae:03:ff:31</mac-address>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 796 | + "<remote-mep-database>" |
| 797 | + "<remote-mep>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 798 | + "<remote-mep-id>1</remote-mep-id>" |
| 799 | + "</remote-mep>" |
| 800 | + "<remote-mep>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 801 | + "<remote-mep-id>2</remote-mep-id>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 802 | + "</remote-mep>" |
| 803 | + "</remote-mep-database>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 804 | + "<msea-soam-pm:delay-measurements>" |
| 805 | + "<msea-soam-pm:delay-measurement>" |
| 806 | + "<msea-soam-pm:dm-id>1</msea-soam-pm:dm-id>" |
| 807 | + "</msea-soam-pm:delay-measurement>" |
| 808 | + "</msea-soam-pm:delay-measurements>" |
| 809 | + "<msea-soam-pm:loss-measurements>" |
| 810 | + "<msea-soam-pm:loss-measurement>" |
| 811 | + "<msea-soam-pm:lm-id>1</msea-soam-pm:lm-id>" |
| 812 | + "</msea-soam-pm:loss-measurement>" |
| 813 | + "<msea-soam-pm:loss-measurement>" |
| 814 | + "<msea-soam-pm:lm-id>2</msea-soam-pm:lm-id>" |
| 815 | + "</msea-soam-pm:loss-measurement>" |
| 816 | + "</msea-soam-pm:loss-measurements>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 817 | + "</maintenance-association-end-point>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 818 | + "</maintenance-association>" |
| 819 | + "</maintenance-domain>" |
| 820 | + "</mef-cfm>" |
| 821 | + "</data>" |
| 822 | + "</rpc-reply>"; |
| 823 | |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 824 | private static final String SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY = |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 825 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 826 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">" |
| 827 | + "<data>" |
| 828 | + "<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" " |
| 829 | + "xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" " |
| 830 | + "xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">" |
| 831 | + "<maintenance-domain>" |
| 832 | + "<id>1</id>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 833 | + "<name>md-1</name>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 834 | + "<maintenance-association>" |
| 835 | + "<id>1</id>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 836 | + "<name>ma-1-1</name>" |
| 837 | + "<ccm-interval>3.3ms</ccm-interval>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 838 | + "<maintenance-association-end-point>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 839 | + "<mep-identifier>1</mep-identifier>" |
| 840 | + "<interface>eth0</interface>" |
| 841 | + "<primary-vid>20</primary-vid>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 842 | + "<administrative-state>true</administrative-state>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 843 | + "<mac-address>00:b0:ae:03:ff:31</mac-address>" |
| 844 | + "<ccm-ltm-priority>5</ccm-ltm-priority>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 845 | + "<continuity-check>" |
| 846 | + "<cci-enabled>true</cci-enabled>" |
| 847 | + "<fng-state>defect-reported</fng-state>" |
| 848 | + "<highest-priority-defect-found>remote-invalid-ccm</highest-priority-defect-found>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 849 | + "<active-defects>remote-rdi remote-invalid-ccm</active-defects>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 850 | + "<ccm-sequence-error-count>0</ccm-sequence-error-count>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 851 | + "<sent-ccms>197</sent-ccms>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 852 | + "</continuity-check>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 853 | + "<loopback>" |
| 854 | + "</loopback>" |
| 855 | + "<linktrace>" |
| 856 | + "</linktrace>" |
| 857 | + "<remote-mep-database>" |
| 858 | + "<remote-mep>" |
| 859 | + "<remote-mep-id>1</remote-mep-id>" |
| 860 | + "<remote-mep-state>failed</remote-mep-state>" |
| 861 | + "<failed-ok-time>54654654</failed-ok-time>" |
| 862 | + "<mac-address>aa:bb:cc:dd:ee:ff</mac-address>" |
| 863 | + "<rdi>false</rdi>" |
| 864 | + "<port-status-tlv>no-status-tlv</port-status-tlv>" |
| 865 | + "<interface-status-tlv>dormant</interface-status-tlv>" |
| 866 | + "</remote-mep>" |
| 867 | + "<remote-mep>" |
| 868 | + "<remote-mep-id>2</remote-mep-id>" |
| 869 | + "<remote-mep-state>failed</remote-mep-state>" |
| 870 | + "<failed-ok-time>54654654</failed-ok-time>" |
| 871 | + "<mac-address>aa:bb:cc:dd:ee:ff</mac-address>" |
| 872 | + "<rdi>false</rdi>" |
| 873 | + "<port-status-tlv>no-status-tlv</port-status-tlv>" |
| 874 | + "<interface-status-tlv>dormant</interface-status-tlv>" |
| 875 | + "</remote-mep>" |
| 876 | + "</remote-mep-database>" |
| 877 | + "<msea-soam-fm:operational-state>enabled</msea-soam-fm:operational-state>" |
| 878 | + "<msea-soam-fm:connectivity-status>partially-active</msea-soam-fm:connectivity-status>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 879 | + "<msea-soam-fm:port-status>up</msea-soam-fm:port-status>" |
| 880 | + "<msea-soam-fm:interface-status>up</msea-soam-fm:interface-status>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 881 | + "<msea-soam-fm:last-defect-sent>remote-rdi remote-mac-error</msea-soam-fm:last-defect-sent>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 882 | + "<msea-soam-fm:rdi-transmit-status>true</msea-soam-fm:rdi-transmit-status>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 883 | + "</maintenance-association-end-point>" |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 884 | + "</maintenance-association>" |
| 885 | + "</maintenance-domain>" |
| 886 | + "</mef-cfm>" |
| 887 | + "</data>" |
| 888 | + "</rpc-reply>"; |
| 889 | |
| 890 | private static final String SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY = |
| 891 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 892 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"47\">" |
| 893 | + "<data>" |
| 894 | + "<mef-cfm xmlns=\"http://www.microsemi.com/microsemi-edge-assure/msea-cfm\" " |
| 895 | + "xmlns:msea-soam-fm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-fm\" " |
| 896 | + "xmlns:msea-soam-pm=\"http://www.microsemi.com/microsemi-edge-assure/msea-soam-pm\">" |
| 897 | + "<maintenance-domain>" |
| 898 | + "<id>1</id>" |
| 899 | + "<name>md-1</name>" |
| 900 | + "<maintenance-association>" |
| 901 | + "<id>1</id>" |
| 902 | + "<name>ma-1-1</name>" |
| 903 | + "<maintenance-association-end-point>" |
| 904 | + "<mep-identifier>1</mep-identifier>" |
| 905 | + "<msea-soam-pm:delay-measurements>" |
| 906 | + "<msea-soam-pm:delay-measurement>" |
| 907 | + "<msea-soam-pm:dm-id>1</msea-soam-pm:dm-id>" |
| 908 | + "<msea-soam-pm:mep-id>10</msea-soam-pm:mep-id>" |
| 909 | + "<msea-soam-pm:administrative-state>true</msea-soam-pm:administrative-state>" |
| 910 | + "<msea-soam-pm:measurement-enable>frame-delay-two-way-bins " |
| 911 | + "frame-delay-two-way-max</msea-soam-pm:measurement-enable>" |
| 912 | + "<msea-soam-pm:message-period>3ms</msea-soam-pm:message-period>" |
| 913 | + "<msea-soam-pm:priority>6</msea-soam-pm:priority>" |
| 914 | + "<msea-soam-pm:frame-size>1000</msea-soam-pm:frame-size>" |
| 915 | + "<msea-soam-pm:measurement-interval>15</msea-soam-pm:measurement-interval>" |
| 916 | + "<msea-soam-pm:number-intervals-stored>32</msea-soam-pm:number-intervals-stored>" |
| 917 | + "<msea-soam-pm:session-status>active</msea-soam-pm:session-status>" |
| 918 | + "<msea-soam-pm:frame-delay-two-way>100</msea-soam-pm:frame-delay-two-way>" |
| 919 | + "<msea-soam-pm:inter-frame-delay-variation-two-way>101</msea-soam-pm:inter-frame-delay-variation-two-way>" |
| 920 | // + "<msea-soam-pm:current-stats>" |
| 921 | // + "</msea-soam-pm:current-stats>" |
| 922 | // + "<msea-soam-pm:history-stats>" |
| 923 | // + "</msea-soam-pm:history-stats>" |
| 924 | + "</msea-soam-pm:delay-measurement>" |
| 925 | + "</msea-soam-pm:delay-measurements>" |
| 926 | + "</maintenance-association-end-point>" |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 927 | + "</maintenance-association>" |
| 928 | + "</maintenance-domain>" |
| 929 | + "</mef-cfm>" |
| 930 | + "</data>" |
| 931 | + "</rpc-reply>"; |
| 932 | |
| 933 | private static final String SAMPLE_REPLY_OK = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 934 | + "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"2\">" |
| 935 | + "<ok/>" |
| 936 | + "</rpc-reply>"; |
| 937 | |
| 938 | private NetconfDeviceInfo deviceInfo; |
| 939 | |
| 940 | private final AtomicInteger messageIdInteger = new AtomicInteger(0); |
| 941 | |
| 942 | public MockNetconfSessionEa1000(NetconfDeviceInfo deviceInfo) throws NetconfException { |
| 943 | this.deviceInfo = deviceInfo; |
| 944 | } |
| 945 | |
| 946 | @Override |
| 947 | public CompletableFuture<String> request(String request) throws NetconfException { |
| 948 | // TODO Auto-generated method stub |
| 949 | return null; |
| 950 | } |
| 951 | |
| 952 | @Override |
| 953 | public String get(String request) throws NetconfException { |
| 954 | |
| 955 | return sendRequest(request); |
| 956 | } |
| 957 | |
| 958 | @Override |
| 959 | public String get(String filterSchema, String withDefaultsMode) throws NetconfException { |
| 960 | StringBuilder rpc = new StringBuilder(XML_HEADER); |
| 961 | rpc.append(RPC_OPEN); |
| 962 | rpc.append(MESSAGE_ID_STRING); |
| 963 | rpc.append(EQUAL); |
| 964 | rpc.append("\""); |
| 965 | rpc.append(messageIdInteger.get()); |
| 966 | rpc.append("\" "); |
| 967 | rpc.append(NETCONF_BASE_NAMESPACE).append(">\n"); |
| 968 | rpc.append(GET_OPEN).append(NEW_LINE); |
| 969 | if (filterSchema != null) { |
| 970 | rpc.append(SUBTREE_FILTER_OPEN).append(NEW_LINE); |
| 971 | rpc.append(filterSchema).append(NEW_LINE); |
| 972 | rpc.append(SUBTREE_FILTER_CLOSE).append(NEW_LINE); |
| 973 | } |
| 974 | if (withDefaultsMode != null) { |
| 975 | rpc.append(WITH_DEFAULT_OPEN).append(NETCONF_WITH_DEFAULTS_NAMESPACE).append(">"); |
| 976 | rpc.append(withDefaultsMode).append(WITH_DEFAULT_CLOSE).append(NEW_LINE); |
| 977 | } |
| 978 | rpc.append(GET_CLOSE).append(NEW_LINE); |
| 979 | rpc.append(RPC_CLOSE).append(NEW_LINE); |
| 980 | rpc.append(ENDPATTERN); |
| 981 | String reply = sendRequest(rpc.toString()); |
| 982 | checkReply(reply); |
| 983 | return reply; |
| 984 | } |
| 985 | |
| 986 | @Override |
| 987 | public String doWrappedRpc(String request) throws NetconfException { |
| 988 | StringBuilder rpc = new StringBuilder(XML_HEADER); |
| 989 | rpc.append(RPC_OPEN); |
| 990 | rpc.append(MESSAGE_ID_STRING); |
| 991 | rpc.append(EQUAL); |
| 992 | rpc.append("\""); |
| 993 | rpc.append(messageIdInteger.get()); |
| 994 | rpc.append("\" "); |
| 995 | rpc.append(NETCONF_BASE_NAMESPACE).append(">\n"); |
| 996 | rpc.append(request); |
| 997 | rpc.append(RPC_CLOSE).append(NEW_LINE); |
| 998 | rpc.append(ENDPATTERN); |
| 999 | String reply = sendRequest(rpc.toString()); |
| 1000 | checkReply(reply); |
| 1001 | return reply; |
| 1002 | } |
| 1003 | |
| 1004 | @Override |
| 1005 | public String requestSync(String request) throws NetconfException { |
| 1006 | if (!request.contains(ENDPATTERN)) { |
| 1007 | request = request + NEW_LINE + ENDPATTERN; |
| 1008 | } |
| 1009 | String reply = sendRequest(request); |
| 1010 | checkReply(reply); |
| 1011 | return reply; |
| 1012 | } |
| 1013 | |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1014 | @Override |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 1015 | public String getConfig(DatastoreId targetConfiguration, String configurationSchema) throws NetconfException { |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1016 | StringBuilder rpc = new StringBuilder(XML_HEADER); |
| 1017 | rpc.append("<rpc "); |
| 1018 | rpc.append(MESSAGE_ID_STRING); |
| 1019 | rpc.append(EQUAL); |
| 1020 | rpc.append("\""); |
| 1021 | rpc.append(messageIdInteger.get()); |
| 1022 | rpc.append("\" "); |
| 1023 | rpc.append("xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n"); |
| 1024 | rpc.append("<get-config>\n"); |
| 1025 | rpc.append("<source>\n"); |
| 1026 | rpc.append("<").append(targetConfiguration).append("/>"); |
| 1027 | rpc.append("</source>"); |
| 1028 | if (configurationSchema != null) { |
| 1029 | rpc.append("<filter type=\"subtree\">\n"); |
| 1030 | rpc.append(configurationSchema).append("\n"); |
| 1031 | rpc.append("</filter>\n"); |
| 1032 | } |
| 1033 | rpc.append("</get-config>\n"); |
| 1034 | rpc.append("</rpc>\n"); |
| 1035 | rpc.append(ENDPATTERN); |
| 1036 | String reply = sendRequest(rpc.toString()); |
| 1037 | return checkReply(reply) ? reply : "ERROR " + reply; |
| 1038 | } |
| 1039 | |
| 1040 | @Override |
| 1041 | public boolean editConfig(String newConfiguration) throws NetconfException { |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 1042 | return editConfig(DatastoreId.RUNNING, null, newConfiguration); |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1043 | } |
| 1044 | |
| 1045 | @Override |
Sean Condon | 06613e9 | 2017-06-09 15:14:01 +0100 | [diff] [blame] | 1046 | public boolean editConfig(DatastoreId targetConfiguration, String mode, String newConfiguration) |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1047 | throws NetconfException { |
| 1048 | newConfiguration = newConfiguration.trim(); |
| 1049 | StringBuilder rpc = new StringBuilder(XML_HEADER); |
| 1050 | rpc.append(RPC_OPEN); |
| 1051 | rpc.append(MESSAGE_ID_STRING); |
| 1052 | rpc.append(EQUAL); |
| 1053 | rpc.append("\""); |
| 1054 | rpc.append(messageIdInteger.get()); |
| 1055 | rpc.append("\" "); |
| 1056 | rpc.append(NETCONF_BASE_NAMESPACE).append(">\n"); |
| 1057 | rpc.append(EDIT_CONFIG_OPEN).append("\n"); |
| 1058 | rpc.append(TARGET_OPEN); |
| 1059 | rpc.append("<").append(targetConfiguration).append("/>"); |
| 1060 | rpc.append(TARGET_CLOSE).append("\n"); |
| 1061 | if (mode != null) { |
| 1062 | rpc.append(DEFAULT_OPERATION_OPEN); |
| 1063 | rpc.append(mode); |
| 1064 | rpc.append(DEFAULT_OPERATION_CLOSE).append("\n"); |
| 1065 | } |
| 1066 | rpc.append(CONFIG_OPEN).append("\n"); |
| 1067 | rpc.append(newConfiguration); |
| 1068 | rpc.append(CONFIG_CLOSE).append("\n"); |
| 1069 | rpc.append(EDIT_CONFIG_CLOSE).append("\n"); |
| 1070 | rpc.append(RPC_CLOSE); |
| 1071 | rpc.append(ENDPATTERN); |
| 1072 | log.debug(rpc.toString()); |
| 1073 | String reply = sendRequest(rpc.toString()); |
| 1074 | return checkReply(reply); |
| 1075 | } |
| 1076 | |
| 1077 | @Override |
| 1078 | public boolean copyConfig(String targetConfiguration, String newConfiguration) throws NetconfException { |
Yuta HIGUCHI | dd7c3f8 | 2017-09-03 14:18:01 -0700 | [diff] [blame] | 1079 | return copyConfig(DatastoreId.datastore(targetConfiguration), newConfiguration); |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | @Override |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1083 | public void startSubscription() throws NetconfException { |
| 1084 | // TODO Auto-generated method stub |
| 1085 | |
| 1086 | } |
| 1087 | |
| 1088 | @Override |
| 1089 | public void startSubscription(String filterSchema) throws NetconfException { |
| 1090 | // TODO Auto-generated method stub |
| 1091 | |
| 1092 | } |
| 1093 | |
| 1094 | @Override |
| 1095 | public void endSubscription() throws NetconfException { |
| 1096 | // TODO Auto-generated method stub |
| 1097 | |
| 1098 | } |
| 1099 | |
| 1100 | @Override |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1101 | public boolean lock() throws NetconfException { |
| 1102 | // TODO Auto-generated method stub |
| 1103 | return false; |
| 1104 | } |
| 1105 | |
| 1106 | @Override |
| 1107 | public boolean unlock() throws NetconfException { |
| 1108 | // TODO Auto-generated method stub |
| 1109 | return false; |
| 1110 | } |
| 1111 | |
| 1112 | @Override |
| 1113 | public boolean close() throws NetconfException { |
| 1114 | // TODO Auto-generated method stub |
| 1115 | return false; |
| 1116 | } |
| 1117 | |
| 1118 | @Override |
| 1119 | public String getSessionId() { |
| 1120 | return "mockSessionId"; |
| 1121 | } |
| 1122 | |
| 1123 | @Override |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1124 | public void addDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 1125 | // TODO Auto-generated method stub |
| 1126 | |
| 1127 | } |
| 1128 | |
| 1129 | @Override |
| 1130 | public void removeDeviceOutputListener(NetconfDeviceOutputEventListener listener) { |
| 1131 | // TODO Auto-generated method stub |
| 1132 | |
| 1133 | } |
| 1134 | |
| 1135 | private boolean checkReply(String reply) throws NetconfException { |
| 1136 | if (reply != null) { |
| 1137 | if (!reply.contains("<rpc-error>")) { |
| 1138 | log.debug("Device {} sent reply {}", deviceInfo, reply); |
| 1139 | return true; |
| 1140 | } else if (reply.contains("<ok/>") |
| 1141 | || (reply.contains("<rpc-error>") |
| 1142 | && reply.contains("warning"))) { |
| 1143 | log.debug("Device {} sent reply {}", deviceInfo, reply); |
| 1144 | return true; |
| 1145 | } |
| 1146 | } |
| 1147 | log.warn("Device {} has error in reply {}", deviceInfo, reply); |
| 1148 | return false; |
| 1149 | } |
| 1150 | |
| 1151 | private String sendRequest(String request) throws NetconfException { |
| 1152 | log.info("Mocking NETCONF Session send request: \n" + request); |
| 1153 | |
| 1154 | if (sampleXmlRegex1.matcher(request).matches()) { |
| 1155 | return SAMPLE_SYSTEM_REPLY; |
| 1156 | |
| 1157 | } else if (sampleXmlRegex2.matcher(request).matches()) { |
| 1158 | return SAMPLE_SYSTEM_REPLY_INIT; |
| 1159 | |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 1160 | } else if (sampleXmlRegexSaFilteringErrorScenario.matcher(request).matches()) { |
| 1161 | return SAMPLE_ERROR_REPLY; |
| 1162 | |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1163 | } else if (sampleXmlRegexSaFiltering.matcher(request).matches()) { |
| 1164 | return SAMPLE_MSEASAFILTERING_FE_REPLY; |
| 1165 | |
| 1166 | } else if (sampleXmlRegexEditConfigSaFilt.matcher(request).matches()) { |
| 1167 | return SAMPLE_REPLY_OK; |
| 1168 | |
| 1169 | } else if (sampleXmlRegexEditDeleteSaFilt.matcher(request).matches()) { |
| 1170 | return SAMPLE_REPLY_OK; |
| 1171 | |
| 1172 | } else if (sampleXmlRegexUniEvc.matcher(request).matches()) { |
| 1173 | return SAMPLE_MSEAEVCUNI_REPLY_INIT; |
| 1174 | |
| 1175 | } else if (sampleXmlRegexUniEvcUni.matcher(request).matches()) { |
| 1176 | return SAMPLE_MSEAEVCUNI_FE_REPLY; |
| 1177 | |
| 1178 | } else if (sampleXmlRegexEditConfigUni1Evc.matcher(request).matches()) { |
| 1179 | return SAMPLE_REPLY_OK; |
| 1180 | |
| 1181 | } else if (sampleXmlRegexEditConfigUni2Evc.matcher(request).matches()) { |
| 1182 | return SAMPLE_REPLY_OK; |
| 1183 | |
| 1184 | } else if (sampleXmlRegexEditConfigUniProfiles.matcher(request).matches()) { |
| 1185 | return SAMPLE_REPLY_OK; |
| 1186 | |
| 1187 | } else if (sampleXmlRegexEditConfigEvcDelete.matcher(request).matches()) { |
| 1188 | return SAMPLE_REPLY_OK; |
| 1189 | |
| 1190 | } else if (sampleXmlRegexGetConfigCeVlanMapsEvc.matcher(request).matches()) { |
| 1191 | return SAMPLE_MSEAEVCUNI_CEVLANMAP_EVC_REPLY; |
| 1192 | |
| 1193 | } else if (sampleXmlRegexEditConfigCeVlanMapReplace.matcher(request).matches()) { |
| 1194 | return SAMPLE_REPLY_OK; |
| 1195 | |
| 1196 | } else if (sampleXmlRegexEditConfigBwpGroup1.matcher(request).matches()) { |
| 1197 | return SAMPLE_REPLY_OK; |
| 1198 | |
| 1199 | } else if (sampleXmlRegexEditConfigBwpGroup1Delete.matcher(request).matches()) { |
| 1200 | return SAMPLE_REPLY_OK; |
| 1201 | |
| 1202 | } else if (sampleXmlRegexSetCurrentDatetime.matcher(request).matches()) { |
| 1203 | return SAMPLE_REPLY_OK; |
| 1204 | |
| 1205 | } else if (sampleXmlRegexGetMseaCfmEssentials.matcher(request).matches()) { |
Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame^] | 1206 | return SAMPLE_MSEACFM_MD_MA_MEP_ESSENTIALS_REPLY; |
| 1207 | |
| 1208 | } else if (sampleXmlRegexGetMseaCfmFull.matcher(request).matches()) { |
| 1209 | return SAMPLE_MSEACFM_MD_MA_MEP_FULL_REPLY; |
| 1210 | |
| 1211 | } else if (sampleXmlRegexDeleteMseaCfmMep.matcher(request).matches()) { |
| 1212 | return SAMPLE_REPLY_OK; |
| 1213 | |
| 1214 | } else if (sampleXmlRegexGetMseaDelay.matcher(request).matches()) { |
| 1215 | return SAMPLE_MSEACFM_DELAY_MEASUREMENT_FULL_REPLY; |
| 1216 | |
| 1217 | } else if (sampleXmlRegexEditConfigDmCreate.matcher(request).matches()) { |
| 1218 | return SAMPLE_REPLY_OK; |
| 1219 | |
| 1220 | } else if (sampleXmlRegexTransmitLoopback.matcher(request).matches()) { |
| 1221 | return SAMPLE_REPLY_OK; |
| 1222 | |
| 1223 | } else if (sampleXmlRegexAbortLoopback.matcher(request).matches()) { |
| 1224 | return SAMPLE_REPLY_OK; |
Sean Condon | fae8e66 | 2016-12-15 10:25:13 +0000 | [diff] [blame] | 1225 | |
| 1226 | } else { |
| 1227 | throw new NetconfException("MocknetconfSession. No sendRequest() case for query: " + |
| 1228 | request); |
| 1229 | } |
| 1230 | } |
| 1231 | } |