package be.iminds.ilabt.jfed.lowlevel.stitching;

import org.testng.annotations.Test;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

public class StitchingDataTest {

    @Test
    public void testExtractStitchingElementFromRspec() throws Exception {
        String tested = "<rspec type=\"manifest\" xmlns=\"http://www.geni.net/resources/rspec/3\"\n" +
                "    xmlns:ns2=\"http://hpn.east.isi.edu/rspec/ext/stitch/0.1/\"\n" +
                "    xmlns:ns3=\"http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1\"\n" +
                "    xmlns:ns4=\"http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1\"\n" +
                "    xmlns:ns5=\"http://www.geni.net/resources/rspec/ext/postBootScript/1\"\n" +
                "    xmlns:ns6=\"http://www.geni.net/resources/rspec/ext/color/2\"\n" +
                "    xmlns:ns7=\"http://www.geni.net/resources/rspec/ext/storage/1\"\n" +
                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/manifest.xsd http://hpn.east.isi.edu/rspec/ext/stitch/0.1/ http://hpn.east.isi.edu/rspec/ext/stitch/0.1/stitch-schema.xsd http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1 http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/slice-info/1/slice_info.xsd?format=raw http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1 http://groups.geni.net/exogeni/attachment/wiki/RspecExtensions/sliver-info/1/sliver_info.xsd?format=raw http://www.geni.net/resources/rspec/ext/postBootScript/1 http://www.geni.net/resources/rspec/ext/postBootScript/1/request.xsd http://www.geni.net/resources/rspec/ext/color/2 http://www.geni.net/resources/rspec/ext/color/2/color.xsdhttp://www.geni.net/resources/rspec/ext/storage/1 http://www.geni.net/resources/rspec/ext/storage/1/storage.xsd\">\n" +
                "    <link client_id=\"link0\"\n" +
                "        sliver_id=\"urn:publicid:IDN+exogeni.net+sliver+b9c70b4d-4fbb-4ad1-87e7-5fbf02cdcad5:link0\" vlantag=\"unknown\">\n" +
                "        <interface_ref client_id=\"exgpo:if0\"/>\n" +
                "        <component_manager name=\"urn:publicid:IDN+exogeni.net:bbnNet+authority+am\"/>\n" +
                "    </link>\n" +
                "    <ns2:stitching lastUpdateTime=\"Tue Mar 17 10:01:51 EDT 2015\">\n" +
                "        <ns2:path id=\"link0\">\n" +
                "            <ns2:hop id=\"hop1\">\n" +
                "                <ns2:link id=\"urn:publicid:IDN+exogeni.net:bbnNet+interface+bbnNet:Domain:vlan:82e098e1-aa17-469f-8e32-edf37f8ba99c:vlan\">\n" +
                "                    <ns2:trafficEngineeringMetric>10</ns2:trafficEngineeringMetric>\n" +
                "                    <ns2:capacity>10000000000</ns2:capacity>\n" +
                "                    <ns2:switchingCapabilityDescriptor>\n" +
                "                        <ns2:switchingcapType>l2sc</ns2:switchingcapType>\n" +
                "                        <ns2:encodingType>ethernet</ns2:encodingType>\n" +
                "                        <ns2:switchingCapabilitySpecificInfo>\n" +
                "                            <ns2:switchingCapabilitySpecificInfo_L2sc>\n" +
                "                                <ns2:vlanRangeAvailability>1-4096</ns2:vlanRangeAvailability>\n" +
                "                                <ns2:suggestedVLANRange>1-4096</ns2:suggestedVLANRange>\n" +
                "                                <ns2:vlanTranslation>false</ns2:vlanTranslation>\n" +
                "                            </ns2:switchingCapabilitySpecificInfo_L2sc>\n" +
                "                        </ns2:switchingCapabilitySpecificInfo>\n" +
                "                    </ns2:switchingCapabilityDescriptor>\n" +
                "                </ns2:link>\n" +
                "                <ns2:nextHop>null</ns2:nextHop>\n" +
                "            </ns2:hop>\n" +
                "        </ns2:path>\n" +
                "    </ns2:stitching>\n" +
                "    <ns3:geni_slice_info state=\"configuring\"\n" +
                "        urn=\"urn:publicid:IDN+ch.geni.net:fed4firetest3+slice+tst22S3\" uuid=\"559b0f63-dfca-4e36-8dc1-1666c3f46ce6\"/>\n" +
                "</rspec>\n";
        assertThat(StitchingData.extractStitchingElementFromRspec(tested), is(notNullValue()));
    }
    @Test
    public void testExtractStitchingElementFromRspec2() throws Exception {
        String tested = "<rspec xmlns=\"http://www.geni.net/resources/rspec/3\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:delay=\"http://www.protogeni.net/resources/rspec/ext/delay/1\" xmlns:jfed-command=\"http://jfed.iminds.be/rspec/ext/jfed-command/1\" xmlns:client=\"http://www.protogeni.net/resources/rspec/ext/client/1\" xmlns:jfed-ssh-keys=\"http://jfed.iminds.be/rspec/ext/jfed-ssh-keys/1\" xmlns:jfed=\"http://jfed.iminds.be/rspec/ext/jfed/1\" xmlns:sharedvlan=\"http://www.protogeni.net/resources/rspec/ext/shared-vlan/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" type=\"request\" generated_by=\"jFed RSpec Editor\" generated=\"2015-03-17T13:56:50.519+01:00\" xsi:schemaLocation=\"http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd  http://hpn.east.isi.edu/rspec/ext/stitch/0.1/ http://hpn.east.isi.edu/rspec/ext/stitch/0.1/stitch-schema.xsd\">\n" +
                "  <node client_id=\"exgpo\" exclusive=\"false\" component_manager_id=\"urn:publicid:IDN+exogeni.net:bbnvmsite+authority+am\">\n" +
                "    <sliver_type name=\"default-vm\"/>\n" +
                "    <location xmlns=\"http://jfed.iminds.be/rspec/ext/jfed/1\" x=\"34.0\" y=\"36.5\"/>\n" +
                "    <interface client_id=\"exgpo:if0\">\n" +
                "      <ip address=\"192.168.0.1\" netmask=\"255.255.255.0\" type=\"ipv4\"/>\n" +
                "    </interface>\n" +
                "  </node>\n" +
                "  <node client_id=\"nys\" exclusive=\"false\" component_manager_id=\"urn:publicid:IDN+instageni.nysernet.org+authority+cm\">\n" +
                "    <sliver_type name=\"default-vm\"/>\n" +
                "    <location xmlns=\"http://jfed.iminds.be/rspec/ext/jfed/1\" x=\"45.0\" y=\"146.5\"/>\n" +
                "    <interface client_id=\"mis:if0\">\n" +
                "      <ip address=\"192.168.0.2\" netmask=\"255.255.255.0\" type=\"ipv4\"/>\n" +
                "    </interface>\n" +
                "  </node>\n" +
                "  <link client_id=\"link0\">\n" +
                "    <component_manager name=\"urn:publicid:IDN+exogeni.net:bbnvmsite+authority+am\"/>\n" +
                "    <component_manager name=\"urn:publicid:IDN+exogeni.net:bbnNet+authority+am\"/><component_manager name=\"urn:publicid:IDN+ion.internet2.edu+authority+am\"/><component_manager name=\"urn:publicid:IDN+al2s.internet2.edu+authority+am\"/><component_manager name=\"urn:publicid:IDN+instageni.nysernet.org+authority+cm\"/>\n" +
                "    <interface_ref client_id=\"exgpo:if0\"/>\n" +
                "    <interface_ref client_id=\"mis:if0\"/>\n" +
                "    <property source_id=\"exgpo:if0\" dest_id=\"mis:if0\" capacity=\"10000\"/>\n" +
                "    <property source_id=\"mis:if0\" dest_id=\"exgpo:if0\" capacity=\"10000\"/>\n" +
                "  </link>\n" +
                "<stitching xmlns=\"http://hpn.east.isi.edu/rspec/ext/stitch/0.1/\" lastUpdateTime=\"20150317:12:57:02\"><path id=\"link0\"><hop id=\"1\"><link id=\"urn:publicid:IDN+exogeni.net:bbnvmsite+interface+Bbn:ExoGeni:TenGigabitEthernet:1:ethernet\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>2-4094</vlanRangeAvailability><suggestedVLANRange>3737</suggestedVLANRange><vlanTranslation>false</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>2</nextHop></hop><hop id=\"2\"><link id=\"urn:publicid:IDN+exogeni.net:bbnNet+interface+BbnNet:IBM:G8052:TenGigabitEthernet:1:1:ethernet\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>2-4094</vlanRangeAvailability><suggestedVLANRange>3737</suggestedVLANRange><vlanTranslation>false</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>3</nextHop></hop><hop id=\"3\"><link id=\"urn:publicid:IDN+exogeni.net:bbnNet+interface+BbnNet:IBM:G8052:GigabitEthernet:1:2:ethernet\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability><suggestedVLANRange>3737</suggestedVLANRange><vlanTranslation>false</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>4</nextHop></hop><hop id=\"4\"><link id=\"urn:publicid:IDN+ion.internet2.edu+interface+rtr.newy:et-5/0/0:gpo-eg\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability><suggestedVLANRange>3737</suggestedVLANRange><vlanTranslation>true</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>5</nextHop></hop><hop id=\"5\"><link id=\"urn:publicid:IDN+ion.internet2.edu+interface+rtr.newy:et-5/0/0:al2s\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>3900-4000</vlanRangeAvailability><suggestedVLANRange>3970</suggestedVLANRange><vlanTranslation>true</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>6</nextHop></hop><hop id=\"6\"><link id=\"urn:publicid:IDN+al2s.internet2.edu+interface+sdn-sw.newy32aoa.net.internet2.edu:eth3/2:*\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>3900-4000</vlanRangeAvailability><suggestedVLANRange>3970</suggestedVLANRange><vlanTranslation>true</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>7</nextHop></hop><hop id=\"7\"><link id=\"urn:publicid:IDN+al2s.internet2.edu+interface+sdn-sw.newy32aoa.net.internet2.edu:eth7/2:nysernet-ig\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>9000</interfaceMTU><vlanRangeAvailability>1700-1719</vlanRangeAvailability><suggestedVLANRange>1714</suggestedVLANRange><vlanTranslation>true</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>8</nextHop></hop><hop id=\"8\"><link id=\"urn:publicid:IDN+instageni.nysernet.org+interface+procurve2:1.19.al2s\"><trafficEngineeringMetric>10</trafficEngineeringMetric><capacity>10000</capacity><switchingCapabilityDescriptor><switchingcapType>l2sc</switchingcapType><encodingType>ethernet</encodingType><switchingCapabilitySpecificInfo><switchingCapabilitySpecificInfo_L2sc><interfaceMTU>1500</interfaceMTU><vlanRangeAvailability>1700-1719</vlanRangeAvailability><suggestedVLANRange>1714</suggestedVLANRange><vlanTranslation>false</vlanTranslation></switchingCapabilitySpecificInfo_L2sc></switchingCapabilitySpecificInfo></switchingCapabilityDescriptor></link><nextHop>null</nextHop></hop></path></stitching></rspec>\n";
        assertThat(StitchingData.extractStitchingElementFromRspec(tested), is(notNullValue()));
    } @Test
    public void testExtractStitchingElementFromRspec3() throws Exception {
        String tested = "<rspec xmlns=\"http://www.geni.net/resources/rspec/3\" xmlns:client=\"http://www.protogeni.net/resources/rspec/ext/client/1\" xmlns:delay=\"http://www.protogeni.net/resources/rspec/ext/delay/1\" xmlns:emulab=\"http://www.protogeni.net/resources/rspec/ext/emulab/1\" xmlns:jfed=\"http://jfed.iminds.be/rspec/ext/jfed/1\" xmlns:jfed-command=\"http://jfed.iminds.be/rspec/ext/jfed-command/1\" xmlns:jfed-ssh-keys=\"http://jfed.iminds.be/rspec/ext/jfed-ssh-keys/1\" xmlns:sharedvlan=\"http://www.protogeni.net/resources/rspec/ext/shared-vlan/1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" generated=\"2015-03-17T15:44:44.476+01:00\" generated_by=\"jFed RSpec Editor\" type=\"request\" xsi:schemaLocation=\"http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd  http://hpn.east.isi.edu/rspec/ext/stitch/0.1/ http://hpn.east.isi.edu/rspec/ext/stitch/0.1/stitch-schema.xsd\">\\n  <node client_id=\"exgpo\" component_manager_id=\"urn:publicid:IDN+exogeni.net:bbnvmsite+authority+am\" exclusive=\"false\">\\n    <sliver_type name=\"default-vm\"/>\\n    <location xmlns=\"http://jfed.iminds.be/rspec/ext/jfed/1\" x=\"34.0\" y=\"36.5\"/>\\n    <interface client_id=\"exgpo:if0\">\\n      <ip address=\"192.168.0.1\" netmask=\"255.255.255.0\" type=\"ipv4\"/>\\n    </interface>\\n  </node>\\n  <node client_id=\"ny\" component_manager_id=\"urn:publicid:IDN+instageni.nysernet.org+authority+cm\" exclusive=\"false\" component_id=\"urn:publicid:IDN+instageni.nysernet.org+node+pc3\" sliver_id=\"urn:publicid:IDN+instageni.nysernet.org+sliver+27071\">\\n    <sliver_type name=\"default-vm\"/>\\n    <location xmlns=\"http://jfed.iminds.be/rspec/ext/jfed/1\" x=\"45.0\" y=\"146.5\"/>\\n    <interface client_id=\"mis:if0\" component_id=\"eth1\">\\n      <ip address=\"192.168.0.2\" netmask=\"255.255.255.0\" type=\"ipv4\"/>\\n    </interface>\\n  <emulab:vnode name=\"pcvm3-12\"/></node>\\n  <link client_id=\"link0\" vlantag=\"1711\">\\n    <component_manager name=\"urn:publicid:IDN+exogeni.net:bbnvmsite+authority+am\"/>\\n    <component_manager name=\"urn:publicid:IDN+exogeni.net:bbnNet+authority+am\"/>\\n    <component_manager name=\"urn:publicid:IDN+ion.internet2.edu+authority+am\"/>\\n    <component_manager name=\"urn:publicid:IDN+al2s.internet2.edu+authority+am\"/>\\n    <component_manager name=\"urn:publicid:IDN+instageni.nysernet.org+authority+cm\"/>\\n    <interface_ref client_id=\"exgpo:if0\"/>\\n    <interface_ref client_id=\"mis:if0\"/>\\n    <property capacity=\"10000\" dest_id=\"mis:if0\" source_id=\"exgpo:if0\"/>\\n    <property capacity=\"10000\" dest_id=\"exgpo:if0\" source_id=\"mis:if0\"/>\\n  </link>\\n<stitching xmlns=\"http://hpn.east.isi.edu/rspec/ext/stitch/0.1/\" lastUpdateTime=\"20150317:14:44:57\">\\n    <path id=\"link0\">\\n      <hop id=\"1\">\\n        <link id=\"urn:publicid:IDN+exogeni.net:bbnvmsite+interface+Bbn:ExoGeni:TenGigabitEthernet:1:ethernet\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability>\\n                <suggestedVLANRange>3738</suggestedVLANRange>\\n                <vlanTranslation>false</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>2</nextHop>\\n      </hop>\\n      <hop id=\"2\">\\n        <link id=\"urn:publicid:IDN+exogeni.net:bbnNet+interface+BbnNet:IBM:G8052:TenGigabitEthernet:1:1:ethernet\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability>\\n                <suggestedVLANRange>3738</suggestedVLANRange>\\n                <vlanTranslation>false</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>3</nextHop>\\n      </hop>\\n      <hop id=\"3\">\\n        <link id=\"urn:publicid:IDN+exogeni.net:bbnNet+interface+BbnNet:IBM:G8052:GigabitEthernet:1:2:ethernet\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability>\\n                <suggestedVLANRange>3738</suggestedVLANRange>\\n                <vlanTranslation>false</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>4</nextHop>\\n      </hop>\\n      <hop id=\"4\">\\n        <link id=\"urn:publicid:IDN+ion.internet2.edu+interface+rtr.newy:et-5/0/0:gpo-eg\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>3736-3739,3741</vlanRangeAvailability>\\n                <suggestedVLANRange>3738</suggestedVLANRange>\\n                <vlanTranslation>true</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>5</nextHop>\\n      </hop>\\n      <hop id=\"5\">\\n        <link id=\"urn:publicid:IDN+ion.internet2.edu+interface+rtr.newy:et-5/0/0:al2s\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>3900-4000</vlanRangeAvailability>\\n                <suggestedVLANRange>3996</suggestedVLANRange>\\n                <vlanTranslation>true</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>6</nextHop>\\n      </hop>\\n      <hop id=\"6\">\\n        <link id=\"urn:publicid:IDN+al2s.internet2.edu+interface+sdn-sw.newy32aoa.net.internet2.edu:eth3/2:*\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>3900-4000</vlanRangeAvailability>\\n                <suggestedVLANRange>3996</suggestedVLANRange>\\n                <vlanTranslation>true</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>7</nextHop>\\n      </hop>\\n      <hop id=\"7\">\\n        <link id=\"urn:publicid:IDN+al2s.internet2.edu+interface+sdn-sw.newy32aoa.net.internet2.edu:eth7/2:nysernet-ig\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>9000</interfaceMTU>\\n                <vlanRangeAvailability>1700-1719</vlanRangeAvailability>\\n                <suggestedVLANRange>1717</suggestedVLANRange>\\n                <vlanTranslation>true</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>8</nextHop>\\n      </hop>\\n      <hop id=\"8\">\\n        <link id=\"urn:publicid:IDN+instageni.nysernet.org+interface+procurve2:1.19.al2s\">\\n          <trafficEngineeringMetric>10</trafficEngineeringMetric>\\n          <capacity>10000</capacity>\\n          <switchingCapabilityDescriptor>\\n            <switchingcapType>l2sc</switchingcapType>\\n            <encodingType>ethernet</encodingType>\\n            <switchingCapabilitySpecificInfo>\\n              <switchingCapabilitySpecificInfo_L2sc>\\n                <interfaceMTU>1500</interfaceMTU>\\n                <vlanRangeAvailability>1711</vlanRangeAvailability>\\n                <suggestedVLANRange>1711</suggestedVLANRange>\\n                <vlanTranslation>false</vlanTranslation>\\n              </switchingCapabilitySpecificInfo_L2sc>\\n            </switchingCapabilitySpecificInfo>\\n          </switchingCapabilityDescriptor>\\n        </link>\\n        <nextHop>null</nextHop>\\n      </hop>\\n    </path>\\n  </stitching>\\n</rspec>";
        assertThat(StitchingData.extractStitchingElementFromRspec(tested), is(notNullValue()));
    }
}