public EdgeBean(NodeConnector connector, Long hostId) { this(); this.source = null; this.destination = connector; this.hostId = hostId; data.put("$bandwidth", "N/A"); data.put("$color", bandwidthColor(new Bandwidth(0))); data.put("$nodeToPort", connector.getNodeConnectorIDString()); data.put("$nodeFromPort", connector.getNodeConnectorIDString()); data.put("$descTo", ""); data.put("$descFrom", ""); data.put("$nodeToPortName", ""); data.put("$nodeFromPortName", ""); }
public static String toNodeConnectorId(final org.opendaylight.controller.sal.core.NodeConnector nc) { final StringBuilder sb = nodeIdBulder(nc.getNode()); sb.append(NODE_TYPE_STRING); sb.append(nc.getNodeConnectorIDString()); return sb.toString(); }
private String getNodeConnectorPortDescription(NodeConnector nodeConnector, ISwitchManager switchManager) { Name ncName = (Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName); String nodeConnectorName = nodeConnector.getNodeConnectorIDString(); if (ncName != null) { nodeConnectorName = ncName.getValue(); } return nodeConnectorName; }
public static boolean getNodeAndNcIdString(Edge edge, String headNodeIdStr, String tailNodeIdStr, String headNcIdStr, String tailNcIdStr){ NodeConnector headNC = edge.getHeadNodeConnector(); NodeConnector tailNC = edge.getTailNodeConnector(); if(headNC == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's head nodeconnector is null!"); return false; } if(tailNC == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's tail nodeconnector is null!"); return false; } Node headNode = headNC.getNode(); Node tailNode = tailNC.getNode(); if(headNode == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's head node is null!"); return false; } if(tailNode == null){ logger.debug("ERROR: getNodeAndNcIdString(): given edge's tail node is null!"); return false; } headNodeIdStr = headNode.getNodeIDString(); tailNodeIdStr = tailNode.getNodeIDString(); headNcIdStr = headNC.getNodeConnectorIDString(); tailNcIdStr = tailNC.getNodeConnectorIDString(); return true; } }
Name.NamePropName)).getValue(); port.put( nodeConnector.getID().toString(), nodeConnectorName + "(" + nodeConnector.getNodeConnectorIDString() + ")");
/** * Construct a new port mapping information. * * @param pmconf Port mapping configuration. * @param nc Node connector actually mapped. * @throws NullPointerException * {@code pmconf} is {@code null}. */ public PortMapInfo(PortMapConfig pmconf, NodeConnector nc) { super(pmconf.getNode(), pmconf.getPort(), pmconf.getVlan()); if (nc == null) { mapped = null; } else { String type = nc.getType(); String id = nc.getNodeConnectorIDString(); mapped = new SwitchPort(type, id); } }
/** * Construct a new MAC address entry. * * @param entry MAC address entry. * @throws NullPointerException * {@code entry} is {@code null}. */ public MacEntry(MacAddressEntry entry) { DataLinkAddress dladdr = entry.getAddress(); if (dladdr instanceof EthernetAddress) { EthernetAddress ethaddr = (EthernetAddress)dladdr; this.address = ethaddr.getMacAddress(); } else { this.address = dladdr.toString(); } NodeConnector nc = entry.getNodeConnector(); String type = nc.getType(); String id = nc.getNodeConnectorIDString(); this.port = new SwitchPort(type, id); this.node = nc.getNode(); this.vlan = entry.getVlan(); Set<InetAddress> ipaddrs = entry.getInetAddresses(); if (ipaddrs.size() != 0) { this.inetAddresses = new IpAddressSet(ipaddrs); } }
public static HostConfig convert(HostNodeConnector hnc) { if(hnc == null) { return null; } HostConfig hc = new HostConfig(); DataLinkAddress dl = hnc.getDataLayerAddress(); if(dl instanceof EthernetAddress) { EthernetAddress et = (EthernetAddress) dl; hc.dataLayerAddress = et.getMacAddress(); } else { hc.dataLayerAddress = dl.getName(); } NodeConnector nc = hnc.getnodeConnector(); if(nc != null) { hc.nodeConnectorType = nc.getType(); hc.nodeConnectorId = nc.getNodeConnectorIDString(); Node n = hnc.getnodeconnectorNode(); if(n != null) { hc.nodeType = n.getType(); hc.nodeId = n.getNodeIDString(); } } hc.vlan = String.valueOf(hnc.getVlan()); hc.staticHost = hnc.isStaticHost(); hc.networkAddress = hnc.getNetworkAddressAsString(); return hc; } }
String portId = nodeConnector.getNodeConnectorIDString(); byte[] pidValue = LLDPTLV.createPortIDTLVValue(portId); portIdTlv.setType(LLDPTLV.TLVType.PortID.getValue()).setLength((short) pidValue.length).setValue(pidValue);