@Test public void controllersConfig() { InputStream streamOrig = getClass().getResourceAsStream(CONFIG_XML_FILE); HierarchicalConfiguration cfgOrig = XmlConfigParser.loadXml(streamOrig); List<DeviceInterfaceDescription> actualIntfs = XmlParserCisco.getInterfacesFromConfig(cfgOrig); assertEquals("Interfaces were not retrieved from configuration", getExpectedIntfs(), actualIntfs); }
public static List<DeviceInterfaceDescription> getInterfacesFromConfig( HierarchicalConfiguration cfg) { List<DeviceInterfaceDescription> intfs = Lists.newArrayList(); List<HierarchicalConfiguration> subtrees = cfg.configurationsAt("data.xml-config-data.Device-Configuration.interface"); for (HierarchicalConfiguration intfConfig :subtrees) { String intfName = getInterfaceName(intfConfig); DeviceInterfaceDescription.Mode intfMode = getInterfaceMode(intfConfig); List<VlanId> intfVlans = getInterfaceVlans(intfConfig, intfMode); short intfLimit = getInterfaceLimit(intfConfig); boolean intfLimited = (intfLimit == NO_LIMIT ? false : true); DeviceInterfaceDescription intf = new DefaultDeviceInterfaceDescription(intfName, intfMode, intfVlans, intfLimited, intfLimit); intfs.add(intf); } return intfs; }
XmlParserCisco { public static List<DeviceInterfaceDescription> getInterfacesFromConfig( HierarchicalConfiguration cfg) { List<DeviceInterfaceDescription> intfs = Lists.newArrayList(); List<HierarchicalConfiguration> subtrees = cfg.configurationsAt("data.xml-config-data.Device-Configuration.interface"); for (HierarchicalConfiguration intfConfig :subtrees) { String intfName = getInterfaceName(intfConfig); DeviceInterfaceDescription.Mode intfMode = getInterfaceMode(intfConfig); List<VlanId> intfVlans = getInterfaceVlans(intfConfig, intfMode); short intfLimit = getInterfaceLimit(intfConfig); boolean intfLimited = (intfLimit == NO_LIMIT ? false : true); DeviceInterfaceDescription intf = new DefaultDeviceInterfaceDescription(intfName, intfMode, intfVlans, intfLimited, intfLimit); intfs.add(intf); } return intfs; } }
XmlParserCisco { public static List<DeviceInterfaceDescription> getInterfacesFromConfig( HierarchicalConfiguration cfg) { List<DeviceInterfaceDescription> intfs = Lists.newArrayList(); List<HierarchicalConfiguration> subtrees = cfg.configurationsAt("data.xml-config-data.Device-Configuration.interface"); for (HierarchicalConfiguration intfConfig :subtrees) { String intfName = getInterfaceName(intfConfig); DeviceInterfaceDescription.Mode intfMode = getInterfaceMode(intfConfig); List<VlanId> intfVlans = getInterfaceVlans(intfConfig, intfMode); short intfLimit = getInterfaceLimit(intfConfig); boolean intfLimited = (intfLimit == NO_LIMIT ? false : true); DeviceInterfaceDescription intf = new DefaultDeviceInterfaceDescription(intfName, intfMode, intfVlans, intfLimited, intfLimit); intfs.add(intf); } return intfs; } private  XmlParserCisco(); }
XmlParserCisco { public static List<DeviceInterfaceDescription> getInterfacesFromConfig( HierarchicalConfiguration cfg) { List<DeviceInterfaceDescription> intfs = Lists.newArrayList(); List<HierarchicalConfiguration> subtrees = cfg.configurationsAt("data.xml-config-data.Device-Configuration.interface"); for (HierarchicalConfiguration intfConfig :subtrees) { String intfName = getInterfaceName(intfConfig); DeviceInterfaceDescription.Mode intfMode = getInterfaceMode(intfConfig); List<VlanId> intfVlans = getInterfaceVlans(intfConfig, intfMode); short intfLimit = getInterfaceLimit(intfConfig); boolean intfLimited = (intfLimit == NO_LIMIT ? false : true); DeviceInterfaceDescription intf = new DefaultDeviceInterfaceDescription(intfName, intfMode, intfVlans, intfLimited, intfLimit); intfs.add(intf); } return intfs; } private  XmlParserCisco(); static List<DeviceInterfaceDescription> getInterfacesFromConfig(
            HierarchicalConfiguration cfg); }
XmlParserCisco { public static List<DeviceInterfaceDescription> getInterfacesFromConfig( HierarchicalConfiguration cfg) { List<DeviceInterfaceDescription> intfs = Lists.newArrayList(); List<HierarchicalConfiguration> subtrees = cfg.configurationsAt("data.xml-config-data.Device-Configuration.interface"); for (HierarchicalConfiguration intfConfig :subtrees) { String intfName = getInterfaceName(intfConfig); DeviceInterfaceDescription.Mode intfMode = getInterfaceMode(intfConfig); List<VlanId> intfVlans = getInterfaceVlans(intfConfig, intfMode); short intfLimit = getInterfaceLimit(intfConfig); boolean intfLimited = (intfLimit == NO_LIMIT ? false : true); DeviceInterfaceDescription intf = new DefaultDeviceInterfaceDescription(intfName, intfMode, intfVlans, intfLimited, intfLimit); intfs.add(intf); } return intfs; } private  XmlParserCisco(); static List<DeviceInterfaceDescription> getInterfacesFromConfig(
            HierarchicalConfiguration cfg);  }