private PortDescription toPortDescription(HierarchicalConfiguration component) {
        try {
            return toPortDescriptionInternal(component);
        } catch (Exception e) {
            log.error("Unexpected exception parsing component {} on {}",
                      component.getString("name"),
                      data().deviceId(), e);
            return null;
        }
    }
@Test
    public void testToPortDescription() throws ConfigurationException, IOException {
        // CHECKSTYLE:OFF
        String input =
          "<data>\n" +
          "  <interfaces xmlns=\"http://openconfig.net/yang/interfaces\">\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-2</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-2</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-3</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-3</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-4</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-4</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-5</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-5</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>CARRIERCTP.1-L1-6</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>CARRIERCTP.1-L1-6</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>GIGECLIENTCTP.1-A-2-T1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>GIGECLIENTCTP.1-A-2-T1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>GIGECLIENTCTP.1-A-2-T2</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>GIGECLIENTCTP.1-A-2-T2</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>GIGECLIENTCTP.1-L1-1-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>GIGECLIENTCTP.1-L1-1-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>GIGECLIENTCTP.1-L2-1-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>GIGECLIENTCTP.1-L2-1-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>NCTGIGE.1-NCT-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n" +
          "        <name>NCTGIGE.1-NCT-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>NCTGIGE.1-NCT-2</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n" +
          "        <name>NCTGIGE.1-NCT-2</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>OCHCTP.1-L1-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>OCHCTP.1-L1-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>SCHCTP.1-L1-1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>SCHCTP.1-L1-1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>TRIBPTP.1-A-2-T1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>TRIBPTP.1-A-2-T1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>TRIBPTP.1-A-2-T2</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>TRIBPTP.1-A-2-T2</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "    <interface>\n" +
          "      <name>XTSCGPTP.1-L1</name>\n" +
          "      <config>\n" +
          "        <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:opticalTransport</type>\n" +
          "        <name>XTSCGPTP.1-L1</name>\n" +
          "        <description/>\n" +
          "        <enabled>true</enabled>\n" +
          "      </config>\n" +
          "    </interface>\n" +
          "  </interfaces>\n" +
          "</data>\n";
        // CHECKSTYLE:ON

        InfineraOpenConfigDeviceDiscovery sut = new InfineraOpenConfigDeviceDiscovery();

        XMLConfiguration cfg = new XMLConfiguration();
        cfg.load(CharSource.wrap(input).openStream());

        List<PortDescription> ports = sut.discoverPorts(cfg);

        assertThat(ports, hasSize(4));

        PortDescription portDescription;
        portDescription = ports.get(0);
        assertThat(portDescription.portNumber().toLong(), is(1L));
        assertThat(portDescription.portNumber().name(), is("GIGECLIENTCTP.1-A-2-T1"));
        assertThat(portDescription.annotations().value(OC_NAME), is("GIGECLIENTCTP.1-A-2-T1"));
        assertThat(portDescription.annotations().value(OC_TYPE), is("GIGECLIENTCTP.1-A-2-T1"));
        assertThat(portDescription.annotations().value(ODTN_PORT_TYPE),
                is(OdtnDeviceDescriptionDiscovery.OdtnPortType.CLIENT.value()));

        portDescription = ports.get(3);
        assertThat(portDescription.portNumber().toLong(), is(102L));
        assertThat(portDescription.portNumber().name(), is("GIGECLIENTCTP.1-L2-1-1"));
        assertThat(portDescription.annotations().value(OC_NAME), is("GIGECLIENTCTP.1-L2-1-1"));
        assertThat(portDescription.annotations().value(OC_TYPE), is("GIGECLIENTCTP.1-L2-1-1"));
        assertThat(portDescription.annotations().value(ODTN_PORT_TYPE),
                is(OdtnDeviceDescriptionDiscovery.OdtnPortType.LINE.value()));
    }