本文整理汇总了Java中org.onlab.packet.TpPort类的典型用法代码示例。如果您正苦于以下问题:Java TpPort类的具体用法?Java TpPort怎么用?Java TpPort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TpPort类属于org.onlab.packet包,在下文中一共展示了TpPort类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildMatchPort
import org.onlab.packet.TpPort; //导入依赖的package包/类
private void buildMatchPort(TrafficSelector.Builder sBuilder, String protocol,
OpenstackSecurityGroupRule.Direction direction,
int portMin, int portMax) {
if (portMin > 0 && portMax > 0 && portMin == portMax) {
if (protocol.toUpperCase().equals(PROTO_TCP)) {
if (direction.equals(OpenstackSecurityGroupRule.Direction.EGRESS)) {
sBuilder.matchTcpDst(TpPort.tpPort(portMax));
} else {
sBuilder.matchTcpSrc(TpPort.tpPort(portMax));
}
} else if (protocol.toUpperCase().equals(PROTO_UDP)) {
if (direction.equals(OpenstackSecurityGroupRule.Direction.EGRESS)) {
sBuilder.matchUdpDst(TpPort.tpPort(portMax));
} else {
sBuilder.matchUdpSrc(TpPort.tpPort(portMax));
}
}
}
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:OpenstackSecurityGroupRulePopulator.java
示例2: OpenstackNode
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Creates a new node.
*
* @param hostName hostName
* @param ovsdbIp OVSDB server IP address
* @param ovsdbPort OVSDB server port number
* @param bridgeId integration bridge identifier
* @param openstackNodeType openstack node type
* @param gatewayExternalInterfaceName gatewayExternalInterfaceName
* @param gatewayExternalInterfaceMac gatewayExternalInterfaceMac
*/
public OpenstackNode(String hostName, IpAddress ovsdbIp, TpPort ovsdbPort, DeviceId bridgeId,
OpenstackNodeService.OpenstackNodeType openstackNodeType,
String gatewayExternalInterfaceName,
MacAddress gatewayExternalInterfaceMac) {
this.hostName = checkNotNull(hostName, "hostName cannot be null");
this.ovsdbIp = checkNotNull(ovsdbIp, "ovsdbIp cannot be null");
this.ovsdbPort = checkNotNull(ovsdbPort, "ovsdbPort cannot be null");
this.bridgeId = checkNotNull(bridgeId, "bridgeId cannot be null");
this.openstackNodeType = checkNotNull(openstackNodeType, "openstackNodeType cannot be null");
this.gatewayExternalInterfaceName = gatewayExternalInterfaceName;
this.gatewayExternalInterfaceMac = gatewayExternalInterfaceMac;
if (openstackNodeType == OpenstackNodeService.OpenstackNodeType.GATEWAYNODE) {
checkNotNull(gatewayExternalInterfaceName, "gatewayExternalInterfaceName cannot be null");
checkNotNull(gatewayExternalInterfaceMac, "gatewayExternalInterfaceMac cannot be null");
}
}
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:OpenstackNode.java
示例3: isController
import org.onlab.packet.TpPort; //导入依赖的package包/类
private boolean isController(JsonNode jsonNode) {
String[] ctrl = jsonNode.asText().split(":");
final String error = "Malformed controller string " + jsonNode.asText() +
". Controller only takes a list of 'IP:port', 'IP', " +
"or just one ':port'.";
try {
if (ctrl.length == 1) {
IpAddress.valueOf(ctrl[INDEX_IP]);
return true;
}
if (ctrl.length == 2 && ctrl[INDEX_IP].isEmpty() &&
object.get(CONTROLLERS).size() == 1) {
TpPort.tpPort(Integer.valueOf(ctrl[INDEX_PORT]));
return true;
}
if (ctrl.length == 2 && !ctrl[INDEX_IP].isEmpty()) {
IpAddress.valueOf(ctrl[INDEX_IP]);
TpPort.tpPort(Integer.valueOf(ctrl[INDEX_PORT]));
return true;
}
throw new InvalidFieldException(CONTROLLERS, error);
} catch (IllegalArgumentException e) {
throw new InvalidFieldException(CONTROLLERS, error);
}
}
开发者ID:opencord,项目名称:vtn,代码行数:26,代码来源:CordVtnConfig.java
示例4: DefaultCordVtnNode
import org.onlab.packet.TpPort; //导入依赖的package包/类
private DefaultCordVtnNode(String hostname,
CidrAddr hostMgmtIp,
CidrAddr localMgmtIp,
CidrAddr dataIp,
DeviceId integrationBridgeId,
String dataIface,
String hostMgmtIface,
TpPort ovsdbPort,
SshAccessInfo sshInfo,
CordVtnNodeState state) {
this.hostname = hostname;
this.hostMgmtIp = hostMgmtIp;
this.localMgmtIp = localMgmtIp;
this.dataIp = dataIp;
this.integrationBridgeId = integrationBridgeId;
this.dataIface = dataIface;
this.hostMgmtIface = hostMgmtIface;
this.ovsdbPort = ovsdbPort;
this.sshInfo = sshInfo;
this.state = state;
}
开发者ID:opencord,项目名称:vtn,代码行数:22,代码来源:DefaultCordVtnNode.java
示例5: testSctpPortCriterion
import org.onlab.packet.TpPort; //导入依赖的package包/类
@Test
public void testSctpPortCriterion() throws Exception {
TpPort value1 = TpPort.tpPort(random.nextInt(2 ^ 16));
TpPort value2 = TpPort.tpPort(random.nextInt(2 ^ 16));
TpPort mask = TpPort.tpPort(random.nextInt(2 ^ 16));
int bitWidth = 16;
SctpPortCriterion criterion = (SctpPortCriterion) Criteria.matchSctpDst(value1);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
SctpPortCriterion maskedCriterion = (SctpPortCriterion) Criteria.matchSctpDstMasked(value2, mask);
PiTernaryFieldMatch ternaryMatch = (PiTernaryFieldMatch) translateCriterion(maskedCriterion, fieldId, TERNARY,
bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getShort(), is((short) criterion.sctpPort().toInt()));
assertThat(ternaryMatch.value().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.sctpPort().toInt()));
assertThat(ternaryMatch.mask().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.mask().toInt()));
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:20,代码来源:PiCriterionTranslatorsTest.java
示例6: testTcpPortCriterion
import org.onlab.packet.TpPort; //导入依赖的package包/类
@Test
public void testTcpPortCriterion() throws Exception {
TpPort value1 = TpPort.tpPort(random.nextInt(2 ^ 16));
TpPort value2 = TpPort.tpPort(random.nextInt(2 ^ 16));
TpPort mask = TpPort.tpPort(random.nextInt(2 ^ 16));
int bitWidth = 16;
TcpPortCriterion criterion = (TcpPortCriterion) Criteria.matchTcpDst(value1);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
TcpPortCriterion maskedCriterion = (TcpPortCriterion) Criteria.matchTcpDstMasked(value2, mask);
PiTernaryFieldMatch ternaryMatch = (PiTernaryFieldMatch) translateCriterion(maskedCriterion, fieldId, TERNARY,
bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getShort(), is((short) criterion.tcpPort().toInt()));
assertThat(ternaryMatch.value().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.tcpPort().toInt()));
assertThat(ternaryMatch.mask().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.mask().toInt()));
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:20,代码来源:PiCriterionTranslatorsTest.java
示例7: buildMatchPort
import org.onlab.packet.TpPort; //导入依赖的package包/类
private void buildMatchPort(TrafficSelector.Builder sBuilder, String protocol, String direction,
int portMin, int portMax) {
if (portMin > 0 && portMax > 0 && portMin == portMax) {
if (protocol.toUpperCase().equals(PROTO_TCP)) {
if (direction.toUpperCase().equals(EGRESS)) {
sBuilder.matchTcpSrc(TpPort.tpPort(portMax));
} else {
sBuilder.matchTcpDst(TpPort.tpPort(portMax));
}
} else if (protocol.toUpperCase().equals(PROTO_UDP)) {
if (direction.toUpperCase().equals(EGRESS)) {
sBuilder.matchUdpSrc(TpPort.tpPort(portMax));
} else {
sBuilder.matchUdpDst(TpPort.tpPort(portMax));
}
}
}
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:OpenstackSecurityGroupHandler.java
示例8: buildPortRangeMatches
import org.onlab.packet.TpPort; //导入依赖的package包/类
private Map<TpPort, TpPort> buildPortRangeMatches(int portMin, int portMax) {
boolean processing = true;
int start = portMin;
Map<TpPort, TpPort> portMaskMap = Maps.newHashMap();
while (processing) {
String minStr = Integer.toBinaryString(start);
String binStrMinPadded = "0000000000000000".substring(minStr.length()) + minStr;
int mask = testMasks(binStrMinPadded, start, portMax);
int maskStart = binLower(binStrMinPadded, mask);
int maskEnd = binHigher(binStrMinPadded, mask);
log.debug("start : {} port/mask = {} / {} ", start, getMask(mask), maskStart);
portMaskMap.put(TpPort.tpPort(maskStart), TpPort.tpPort(Integer.parseInt(getMask(mask), 16)));
start = maskEnd + 1;
if (start > portMax) {
processing = false;
}
}
return portMaskMap;
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:25,代码来源:OpenstackSecurityGroupHandler.java
示例9: buildSelector
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Builds a traffic selector based on the set of input parameters.
*
* @param ipProto IP protocol
* @param srcIp source IP address
* @param dstIp destination IP address
* @param srcTcpPort source TCP port, or null if shouldn't be set
* @param dstTcpPort destination TCP port, or null if shouldn't be set
* @return the new traffic selector
*/
private TrafficSelector buildSelector(byte ipProto, IpAddress srcIp,
IpAddress dstIp, Short srcTcpPort,
Short dstTcpPort) {
TrafficSelector.Builder builder = DefaultTrafficSelector.builder().matchIPProtocol(ipProto);
if (dstIp.isIp4()) {
builder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPSrc(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET_MASK_LENGTH))
.matchIPDst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET_MASK_LENGTH));
} else {
builder.matchEthType(Ethernet.TYPE_IPV6)
.matchIPv6Src(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET6_MASK_LENGTH))
.matchIPv6Dst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET6_MASK_LENGTH));
}
if (srcTcpPort != null) {
builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
}
if (dstTcpPort != null) {
builder.matchTcpDst(TpPort.tpPort(dstTcpPort));
}
return builder.build();
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:36,代码来源:ConnectivityManager.java
示例10: execute
import org.onlab.packet.TpPort; //导入依赖的package包/类
@Override
protected void execute() {
if (!isValidController(strCtrl)) {
error("Invalid controller string %s, must be IP:PORT", strCtrl);
return;
}
OFAgentService service = get(OFAgentService.class);
OFAgentAdminService adminService = get(OFAgentAdminService.class);
OFAgent existing = service.agent(NetworkId.networkId(networkId));
if (existing == null) {
error("OFAgent for network %s does not exist", networkId);
return;
}
String[] temp = strCtrl.split(":");
OFAgent updated = DefaultOFAgent.builder()
.from(existing)
.addController(DefaultOFController.of(
IpAddress.valueOf(temp[0]),
TpPort.tpPort(Integer.valueOf(temp[1]))))
.build();
adminService.updateAgent(updated);
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:OFAgentAddControllerCommand.java
示例11: execute
import org.onlab.packet.TpPort; //导入依赖的package包/类
@Override
protected void execute() {
if (!isValidController(strCtrl)) {
error("Invalid controller string %s, must be IP:PORT", strCtrl);
return;
}
OFAgentService service = get(OFAgentService.class);
OFAgentAdminService adminService = get(OFAgentAdminService.class);
OFAgent existing = service.agent(NetworkId.networkId(networkId));
if (existing == null) {
error("OFAgent for network %s does not exist", networkId);
return;
}
String[] temp = strCtrl.split(":");
OFAgent updated = DefaultOFAgent.builder()
.from(existing)
.deleteController(DefaultOFController.of(
IpAddress.valueOf(temp[0]),
TpPort.tpPort(Integer.valueOf(temp[1]))))
.build();
adminService.updateAgent(updated);
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:26,代码来源:OFAgentDeleteControllerCommand.java
示例12: testUdpPortCriterion
import org.onlab.packet.TpPort; //导入依赖的package包/类
@Test
public void testUdpPortCriterion() throws Exception {
TpPort value1 = TpPort.tpPort(random.nextInt(65536));
TpPort value2 = TpPort.tpPort(random.nextInt(65536));
TpPort mask = TpPort.tpPort(random.nextInt(65536));
int bitWidth = 16;
UdpPortCriterion criterion = (UdpPortCriterion) Criteria.matchUdpDst(value1);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
UdpPortCriterion maskedCriterion = (UdpPortCriterion) Criteria.matchUdpDstMasked(value2, mask);
PiTernaryFieldMatch ternaryMatch = (PiTernaryFieldMatch) translateCriterion(maskedCriterion, fieldId, TERNARY,
bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getShort(), is((short) criterion.udpPort().toInt()));
assertThat(ternaryMatch.value().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.udpPort().toInt()));
assertThat(ternaryMatch.mask().asReadOnlyBuffer().getShort(), is((short) maskedCriterion.mask().toInt()));
}
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:PiCriterionTranslatorsTest.java
示例13: getOvsdbClientService
import org.onlab.packet.TpPort; //导入依赖的package包/类
private OvsdbClientService getOvsdbClientService(DriverHandler handler) {
OvsdbController ovsController = handler.get(OvsdbController.class);
DeviceService deviceService = handler.get(DeviceService.class);
DeviceId ofDeviceId = handler.data().deviceId();
String[] mgmtAddress = deviceService.getDevice(ofDeviceId)
.annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS).split(":");
String targetIp = mgmtAddress[0];
TpPort targetPort = null;
if (mgmtAddress.length > 1) {
targetPort = TpPort.tpPort(Integer.parseInt(mgmtAddress[1]));
}
List<OvsdbNodeId> nodeIds = ovsController.getNodeIds().stream()
.filter(nodeId -> nodeId.getIpAddress().equals(targetIp))
.collect(Collectors.toList());
if (nodeIds.size() == 0) {
//TODO decide what port?
ovsController.connect(IpAddress.valueOf(targetIp),
targetPort == null ? TpPort.tpPort(6640) : targetPort);
delay(1000); //FIXME... connect is async
}
List<OvsdbClientService> clientServices = ovsController.getNodeIds().stream()
.filter(nodeId -> nodeId.getIpAddress().equals(targetIp))
.map(ovsController::getOvsdbClient)
.filter(cs -> cs.getBridges().stream().anyMatch(b -> dpidMatches(b, ofDeviceId)))
.collect(Collectors.toList());
checkState(clientServices.size() > 0, "No clientServices found");
//FIXME add connection to management address if null --> done ?
return clientServices.size() > 0 ? clientServices.get(0) : null;
}
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:OvsdbControllerConfig.java
示例14: ConnectionListener
import org.onlab.packet.TpPort; //导入依赖的package包/类
public ConnectionListener(Controller controller,
IpAddress ip,
TpPort port) {
this.controller = controller;
this.ip = ip;
this.port = port;
}
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:Controller.java
示例15: notifySwitchAvailable
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Pushes the flow rules for forwarding BGP TCP packets to controller.
* It is called when switches are connected and available.
*/
public void notifySwitchAvailable() {
// control plane OVS is available, push default flows
TrafficSelector selectorDst = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_TCP)
.matchTcpDst(TpPort.tpPort(BGP_PORT))
.build();
TrafficSelector selectorSrc = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_TCP)
.matchTcpSrc(TpPort.tpPort(BGP_PORT))
.build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.punt()
.build();
ForwardingObjective puntSrc = DefaultForwardingObjective.builder()
.fromApp(appId)
.makePermanent()
.withSelector(selectorSrc)
.withTreatment(treatment)
.withFlag(ForwardingObjective.Flag.VERSATILE)
.add();
flowObjectiveService.forward(bgpSpeaker.connectPoint().deviceId(),
puntSrc);
ForwardingObjective puntDst = DefaultForwardingObjective.builder()
.fromApp(appId)
.makePermanent()
.withSelector(selectorDst)
.withTreatment(treatment)
.withFlag(ForwardingObjective.Flag.VERSATILE)
.add();
flowObjectiveService.forward(bgpSpeaker.connectPoint().deviceId(),
puntDst);
log.info("Sent punt forwarding objective to {}", bgpSpeaker.connectPoint().deviceId());
}
开发者ID:shlee89,项目名称:athena,代码行数:44,代码来源:TunnellingConnectivityManager.java
示例16: requestPackets
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Request packet in via PacketService.
*/
private void requestPackets() {
TrafficSelector.Builder selectorServer = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_UDP)
.matchUdpDst(TpPort.tpPort(UDP.DHCP_SERVER_PORT))
.matchUdpSrc(TpPort.tpPort(UDP.DHCP_CLIENT_PORT));
packetService.requestPackets(selectorServer.build(), PacketPriority.CONTROL, appId);
selectorServer = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_ARP);
packetService.requestPackets(selectorServer.build(), PacketPriority.CONTROL, appId);
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DhcpManager.java
示例17: cancelPackets
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Cancel requested packets in via packet service.
*/
private void cancelPackets() {
TrafficSelector.Builder selectorServer = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPProtocol(IPv4.PROTOCOL_UDP)
.matchUdpDst(TpPort.tpPort(UDP.DHCP_SERVER_PORT))
.matchUdpSrc(TpPort.tpPort(UDP.DHCP_CLIENT_PORT));
packetService.cancelPackets(selectorServer.build(), PacketPriority.CONTROL, appId);
selectorServer = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_ARP);
packetService.cancelPackets(selectorServer.build(), PacketPriority.CONTROL, appId);
}
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:DhcpManager.java
示例18: buildSelector
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Builds a traffic selector based on the set of input parameters.
*
* @param ipProto IP protocol
* @param srcIp source IP address
* @param dstIp destination IP address
* @param srcTcpPort source TCP port, or null if shouldn't be set
* @param dstTcpPort destination TCP port, or null if shouldn't be set
* @return the new traffic selector
*/
private TrafficSelector buildSelector(byte ipProto, VlanId ingressVlanId,
IpAddress srcIp,
IpAddress dstIp, Short srcTcpPort,
Short dstTcpPort) {
TrafficSelector.Builder builder = DefaultTrafficSelector.builder().matchIPProtocol(ipProto);
// Match on any VLAN Id if a VLAN Id configured on the ingress interface
if (!ingressVlanId.equals(VlanId.NONE)) {
builder.matchVlanId(VlanId.ANY);
}
if (dstIp.isIp4()) {
builder.matchEthType(Ethernet.TYPE_IPV4)
.matchIPSrc(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET_MASK_LENGTH))
.matchIPDst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET_MASK_LENGTH));
} else {
builder.matchEthType(Ethernet.TYPE_IPV6)
.matchIPv6Src(IpPrefix.valueOf(srcIp, IpPrefix.MAX_INET6_MASK_LENGTH))
.matchIPv6Dst(IpPrefix.valueOf(dstIp, IpPrefix.MAX_INET6_MASK_LENGTH));
}
if (srcTcpPort != null) {
builder.matchTcpSrc(TpPort.tpPort(srcTcpPort));
}
if (dstTcpPort != null) {
builder.matchTcpDst(TpPort.tpPort(dstTcpPort));
}
return builder.build();
}
开发者ID:shlee89,项目名称:athena,代码行数:42,代码来源:PeerConnectivityManager.java
示例19: openstackNodes
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Returns the set of nodes read from network config.
*
* @return set of OpensatckNodeConfig or null
*/
public Set<OpenstackNode> openstackNodes() {
Set<OpenstackNode> nodes = Sets.newHashSet();
JsonNode jsonNodes = object.get(NODES);
if (jsonNodes == null) {
return null;
}
jsonNodes.forEach(jsonNode -> {
try {
if (OpenstackNodeService.OpenstackNodeType.valueOf(jsonNode.path(NODE_TYPE).asText()) ==
OpenstackNodeService.OpenstackNodeType.COMPUTENODE) {
nodes.add(new OpenstackNode(
jsonNode.path(HOST_NAME).asText(),
Ip4Address.valueOf(jsonNode.path(OVSDB_IP).asText()),
TpPort.tpPort(jsonNode.path(OVSDB_PORT).asInt()),
DeviceId.deviceId(jsonNode.path(BRIDGE_ID).asText()),
OpenstackNodeService.OpenstackNodeType.valueOf(jsonNode.path(NODE_TYPE).asText()),
null, MacAddress.NONE));
} else {
nodes.add(new OpenstackNode(
jsonNode.path(HOST_NAME).asText(),
Ip4Address.valueOf(jsonNode.path(OVSDB_IP).asText()),
TpPort.tpPort(jsonNode.path(OVSDB_PORT).asInt()),
DeviceId.deviceId(jsonNode.path(BRIDGE_ID).asText()),
OpenstackNodeService.OpenstackNodeType.valueOf(jsonNode.path(NODE_TYPE).asText()),
jsonNode.path(GATEWAY_EXTERNAL_INTERFACE_NAME).asText(),
MacAddress.valueOf(jsonNode.path(GATEWAY_EXTERNAL_INTERFACE_MAC).asText())));
}
} catch (IllegalArgumentException | NullPointerException e) {
log.error("Failed to read {}", e.toString());
}
});
return nodes;
}
开发者ID:shlee89,项目名称:athena,代码行数:42,代码来源:OpenstackNodeConfig.java
示例20: cordVtnNodes
import org.onlab.packet.TpPort; //导入依赖的package包/类
/**
* Returns the set of nodes read from network config.
*
* @return set of CordVtnNodeConfig or empty set
*/
public Set<CordVtnNode> cordVtnNodes() {
Set<CordVtnNode> nodes = Sets.newHashSet();
JsonNode sshNode = object.get(SSH);
String ovsdbPort = getConfig(object, OVSDB_PORT);
object.get(CORDVTN_NODES).forEach(vtnNode -> {
CidrAddr localMgmtIp = CidrAddr.valueOf(get(LOCAL_MANAGEMENT_IP, ""));
CidrAddr hostsMgmtIp = CidrAddr.valueOf(getConfig(vtnNode, HOST_MANAGEMENT_IP));
SshAccessInfo sshInfo = new SshAccessInfo(
hostsMgmtIp.ip().getIp4Address(),
TpPort.tpPort(Integer.parseInt(getConfig(sshNode, SSH_PORT))),
getConfig(sshNode, SSH_USER),
getConfig(sshNode, SSH_KEY_FILE));
CordVtnNode.Builder nodeBuilder = DefaultCordVtnNode.builder()
.hostname(getConfig(vtnNode, HOSTNAME))
.hostManagementIp(hostsMgmtIp)
.localManagementIp(localMgmtIp)
.dataIp(CidrAddr.valueOf(getConfig(vtnNode, DATA_IP)))
.sshInfo(sshInfo)
.integrationBridgeId(DeviceId.deviceId(getConfig(vtnNode, INTEGRATION_BRIDGE_ID)))
.dataInterface(getConfig(vtnNode, DATA_IFACE));
if (!Strings.isNullOrEmpty(ovsdbPort)) {
nodeBuilder.ovsdbPort(TpPort.tpPort(Integer.parseInt(ovsdbPort)));
}
String hostMgmtIface = getConfig(vtnNode, HOST_MANAGEMENT_IFACE);
if (!Strings.isNullOrEmpty(hostMgmtIface)) {
nodeBuilder.hostManagementInterface(hostMgmtIface);
}
nodes.add(nodeBuilder.build());
});
return nodes;
}
开发者ID:opencord,项目名称:vtn,代码行数:44,代码来源:CordVtnConfig.java
注:本文中的org.onlab.packet.TpPort类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论