本文整理匯總了Java中org.onosproject.vtnrsc.VirtualPortId.portId方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualPortId.portId方法的具體用法?Java VirtualPortId.portId怎麽用?Java VirtualPortId.portId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.onosproject.vtnrsc.VirtualPortId
的用法示例。
在下文中一共展示了VirtualPortId.portId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGatewayMac
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
public MacAddress getGatewayMac(HostId hostId) {
checkNotNull(hostId, "hostId cannot be null");
Host host = hostService.getHost(hostId);
String ifaceId = host.annotations().value(IFACEID);
VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
VirtualPort hPort = virtualPortService.getPort(hPortId);
SubnetId subnetId = hPort.fixedIps().iterator().next().subnetId();
Subnet subnet = subnetService.getSubnet(subnetId);
IpAddress gatewayIp = subnet.gatewayIp();
Iterable<VirtualPort> virtualPorts = virtualPortService.getPorts();
MacAddress macAddress = null;
for (VirtualPort port : virtualPorts) {
Set<FixedIp> fixedIpSet = port.fixedIps();
for (FixedIp fixedIp : fixedIpSet) {
if (fixedIp.ip().equals(gatewayIp)) {
macAddress = port.macAddress();
}
}
}
return macAddress;
}
示例2: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
FloatingIpService service = get(FloatingIpService.class);
try {
FloatingIp floatingIpObj = new DefaultFloatingIp(
FloatingIpId.of(id),
TenantId.tenantId(tenantId),
TenantNetworkId.networkId(networkId),
VirtualPortId.portId(portId),
RouterId.valueOf(routerId),
floatingIp == null ? null : IpAddress.valueOf(floatingIp),
fixedIp == null ? null : IpAddress.valueOf(fixedIp),
status == null ? Status.ACTIVE
: Status.valueOf(status));
Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
service.createFloatingIps(floatingIpSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例3: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
Map<String, String> strMap = Maps.newHashMap();
strMap.putIfAbsent("name", name);
strMap.putIfAbsent("deviceOwner", deviceOwner);
strMap.putIfAbsent("bindingvnicType", bindingvnicType);
strMap.putIfAbsent("bindingvifType", bindingvifType);
strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
VirtualPortService service = get(VirtualPortService.class);
VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
TenantNetworkId.networkId(networkId),
false, strMap, VirtualPort.State.ACTIVE,
MacAddress.valueOf(macAddress),
TenantId.tenantId(tenantId),
DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
BindingHostId.bindingHostId(bindingHostId),
allowedAddressPairs, securityGroups);
Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
service.createPorts(virtualPorts);
}
示例4: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
VirtualPortService service = get(VirtualPortService.class);
Map<String, String> strMap = Maps.newHashMap();
strMap.putIfAbsent("name", name);
strMap.putIfAbsent("deviceOwner", deviceOwner);
strMap.putIfAbsent("bindingvnicType", bindingvnicType);
strMap.putIfAbsent("bindingvifType", bindingvifType);
strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
TenantNetworkId.networkId(networkId),
false, strMap, VirtualPort.State.ACTIVE,
MacAddress.valueOf(macAddress),
TenantId.tenantId(tenantId),
DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
BindingHostId.bindingHostId(bindingHostId),
allowedAddressPairs, securityGroups);
Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
service.updatePorts(virtualPorts);
}
示例5: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
RouterService service = get(RouterService.class);
try {
List<String> routes = new ArrayList<String>();
Router router = new DefaultRouter(
RouterId.valueOf(id),
routerName,
adminStateUp,
status == null ? Status.ACTIVE
: Status.valueOf(status),
distributed,
null,
VirtualPortId.portId(gatewayPortId),
TenantId.tenantId(tenantId),
routes);
Set<Router> routerSet = Sets.newHashSet(router);
service.createRouters(routerSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例6: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
RouterService service = get(RouterService.class);
RouterId routerId = RouterId.valueOf(id);
Router router = get(RouterService.class).getRouter(routerId);
try {
List<String> routes = new ArrayList<String>();
Router routerObj = new DefaultRouter(
RouterId.valueOf(id),
routerName == null ? router.name() : routerName,
adminStateUp,
status == null ? Status.ACTIVE
: Status.valueOf(status),
distributed,
null,
gatewayPortId == null ? router.gatewayPortid()
: VirtualPortId.portId(gatewayPortId),
tenantId == null ? router.tenantId()
: TenantId.tenantId(tenantId),
routes);
Set<Router> routerSet = Sets.newHashSet(routerObj);
service.createRouters(routerSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例7: testUpdateFlowClassifier
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
/**
* Checks the operation of updateFlowClassifier() method.
*/
@Test
public void testUpdateFlowClassifier() {
// create a flow classifier
testCreateFlowClassifier();
// new updates
final String name2 = "FlowClassifier2";
final String description2 = "FlowClassifier2";
final String ethType2 = "IPv6";
final String protocol2 = "tcp";
final TenantId tenantId2 = TenantId.tenantId("10");
final VirtualPortId virtualSrcPort2 = VirtualPortId.portId("300");
final VirtualPortId virtualDstPort2 = VirtualPortId.portId("400");
flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId)
.setTenantId(tenantId2).setName(name2).setDescription(description2).setEtherType(ethType2)
.setProtocol(protocol2).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
.setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
.setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort2).setDstPort(virtualDstPort2).build();
assertThat(flowClassifierMgr.updateFlowClassifier(flowClassifier), is(true));
}
示例8: testConstruction
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
/**
* Checks the construction of a DefaultRouter object.
*/
@Test
public void testConstruction() {
final TenantId tenantId = TenantId.tenantId(tenantIdStr);
final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
final RouterId routerId = RouterId.valueOf(routeIdStr1);
final TenantNetworkId networkId = TenantNetworkId
.networkId(tenantNetworkId);
final RouterGateway routerGateway = RouterGateway.routerGateway(
networkId,
true,
Collections
.emptySet());
Router r1 = new DefaultRouter(routerId, routerName, false,
Router.Status.ACTIVE, false,
routerGateway, portId, tenantId, null);
assertThat(routerId, is(notNullValue()));
assertThat(routerId, is(r1.id()));
assertThat(tenantId, is(notNullValue()));
assertThat(tenantId, is(r1.tenantId()));
assertThat(routerGateway, is(notNullValue()));
assertThat(routerGateway, is(r1.externalGatewayInfo()));
}
示例9: testConstruction
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
/**
* Checks the construction of a RouterInterface object.
*/
@Test
public void testConstruction() {
final TenantId tenantId = TenantId.tenantId(tenantIdStr);
final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
final SubnetId subnet = SubnetId.subnetId(subnetIdStr);
RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId,
routerId1,
tenantId);
assertThat(portId, is(notNullValue()));
assertThat(portId, is(ri1.portId()));
assertThat(tenantId, is(notNullValue()));
assertThat(tenantId, is(ri1.tenantId()));
assertThat(routerId1, is(notNullValue()));
assertThat(routerId1, is(ri1.routerId()));
assertThat(subnet, is(notNullValue()));
assertThat(subnet, is(ri1.subnetId()));
}
示例10: onHostVanished
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
public void onHostVanished(Host host) {
DeviceId deviceId = host.location().deviceId();
if (!mastershipService.isLocalMaster(deviceId)) {
return;
}
String ifaceId = host.annotations().value(IFACEID);
if (ifaceId == null) {
log.error("The ifaceId of Host is null");
return;
}
programSffAndClassifierHost(host, Objective.Operation.REMOVE);
// apply L2 openflow rules
applyHostMonitoredL2Rules(host, Objective.Operation.REMOVE);
// apply L3 openflow rules
applyHostMonitoredL3Rules(host, Objective.Operation.REMOVE);
VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
vPortStore.remove(virtualPortId);
}
示例11: createExGwPort
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
private void createExGwPort(TenantNetwork network, Subnet subnet, FixedIp fixedGwIp) {
VirtualPortService service = get(VirtualPortService.class);
Map<String, String> strMap = Maps.newHashMap();
VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId("externalgateway-update-id"),
network.id(),
false, strMap,
VirtualPort.State.DOWN,
MacAddress.valueOf(macAddress),
subnet.tenantId(),
DeviceId.deviceId(""),
Sets.newHashSet(fixedGwIp),
BindingHostId.bindingHostId(""),
Sets.newHashSet(),
Sets.newHashSet());
Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
service.createPorts(virtualPorts);
}
示例12: testEquals
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
/**
* Checks the operation of equals().
*/
@Test
public void testEquals() {
final TenantId tenantId = TenantId.tenantId(tenantIdStr);
final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
final RouterId routerId2 = RouterId.valueOf(routeIdStr2);
final SubnetId subnet = SubnetId.subnetId(subnetIdStr);
RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId,
routerId1,
tenantId);
RouterInterface ri2 = RouterInterface.routerInterface(subnet, portId,
routerId1,
tenantId);
RouterInterface ri3 = RouterInterface.routerInterface(subnet, portId,
routerId2,
tenantId);
new EqualsTester().addEqualityGroup(ri1, ri2).addEqualityGroup(ri3)
.testEquals();
}
示例13: programSffAndClassifierHost
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
private void programSffAndClassifierHost(Host host, Objective.Operation type) {
DeviceId deviceId = host.location().deviceId();
String ifaceId = host.annotations().value(IFACEID);
VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
VirtualPort virtualPort = virtualPortService.getPort(virtualPortId);
if (virtualPort == null) {
virtualPort = VtnData.getPort(vPortStore, virtualPortId);
}
TenantId tenantId = virtualPort.tenantId();
if (Objective.Operation.ADD == type) {
vtnRscService.addDeviceIdOfOvsMap(virtualPortId, tenantId, deviceId);
} else if (Objective.Operation.REMOVE == type) {
vtnRscService.removeDeviceIdOfOvsMap(host, tenantId, deviceId);
}
}
示例14: execute
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
@Override
protected void execute() {
FloatingIpService service = get(FloatingIpService.class);
FloatingIpId floatingIpId = FloatingIpId.of(id);
FloatingIp floatingIpStore = get(FloatingIpService.class).getFloatingIp(floatingIpId);
try {
FloatingIp floatingIpObj = new DefaultFloatingIp(
floatingIpId,
tenantId == null ? floatingIpStore.tenantId()
: TenantId.tenantId(tenantId),
networkId == null ? floatingIpStore.networkId()
: TenantNetworkId.networkId(networkId),
portId == null ? floatingIpStore.portId()
: VirtualPortId.portId(portId),
routerId == null ? floatingIpStore.routerId()
: RouterId.valueOf(routerId),
floatingIp == null ? floatingIpStore.floatingIp()
: IpAddress.valueOf(floatingIp),
fixedIp == null ? floatingIpStore.fixedIp()
: IpAddress.valueOf(fixedIp),
status == null ? floatingIpStore.status()
: Status.valueOf(status));
Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
service.updateFloatingIps(floatingIpSet);
} catch (Exception e) {
print(null, e.getMessage());
}
}
示例15: testOnFlowClassifierCreated
import org.onosproject.vtnrsc.VirtualPortId; //導入方法依賴的package包/類
/**
* Checks the operation of onFlowClassifierCreated() method.
*/
@Test
public void testOnFlowClassifierCreated() {
final String name = "FlowClassifier";
final String description = "FlowClassifier";
final String ethType = "IPv4";
final String protocol = "udp";
final int minSrcPortRange = 1024;
final int maxSrcPortRange = 5000;
final int minDstPortRange = 1024;
final int maxDstPortRange = 5000;
final FlowClassifierId flowClassifierId = FlowClassifierId.of("71111111-fc23-aeb6-f44b-56dc5e2fb3ae");
final TenantId tenantId = TenantId.tenantId("8");
final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
final IpPrefix dstIpPrefix = IpPrefix.valueOf("100.100.100.100/0");
final VirtualPortId virtualSrcPort = VirtualPortId.portId("100");
final VirtualPortId virtualDstPort = VirtualPortId.portId("200");
DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
FlowClassifier flowClassifier = null;
SfcService sfcService = new SfcManager();
// create flow classifier
flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId).setTenantId(tenantId)
.setName(name).setDescription(description).setEtherType(ethType).setProtocol(protocol)
.setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
.setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
.setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
sfcService.onFlowClassifierCreated(flowClassifier);
}