本文整理汇总了Java中org.onosproject.incubator.net.virtual.DefaultVirtualNetwork类的典型用法代码示例。如果您正苦于以下问题:Java DefaultVirtualNetwork类的具体用法?Java DefaultVirtualNetwork怎么用?Java DefaultVirtualNetwork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultVirtualNetwork类属于org.onosproject.incubator.net.virtual包,在下文中一共展示了DefaultVirtualNetwork类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNetwork
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
@Override
public VirtualNetwork addNetwork(TenantId tenantId) {
checkState(tenantIdSet.contains(tenantId), "The tenant has not been registered. " + tenantId.id());
VirtualNetwork virtualNetwork = new DefaultVirtualNetwork(genNetworkId(), tenantId);
//TODO update both maps in one transaction.
networkIdVirtualNetworkMap.put(virtualNetwork.id(), virtualNetwork);
Set<NetworkId> networkIdSet = tenantIdNetworkIdSetMap.get(tenantId);
if (networkIdSet == null) {
networkIdSet = new HashSet<>();
}
networkIdSet.add(virtualNetwork.id());
tenantIdNetworkIdSetMap.put(tenantId, networkIdSet);
return virtualNetwork;
}
示例2: testCreateVirtualDeviceWithNoNetwork
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
/**
* Tests adding a virtual device where no virtual network exists.
*/
@Test(expected = IllegalStateException.class)
public void testCreateVirtualDeviceWithNoNetwork() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork = new DefaultVirtualNetwork(NetworkId.NONE, TenantId.tenantId(tenantIdValue1));
manager.createVirtualDevice(virtualNetwork.id(), DeviceId.deviceId(deviceIdValue1));
}
示例3: decode
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
@Override
public VirtualNetwork decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
TenantId tId = TenantId.tenantId(extractMember(TENANT_ID, json));
return new DefaultVirtualNetwork(nId, tId);
}
示例4: testCreateVirtualDeviceWithNoNetwork
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
/**
* Tests adding a virtual device where no virtual network exists.
*/
@Test(expected = IllegalStateException.class)
public void testCreateVirtualDeviceWithNoNetwork() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork =
new DefaultVirtualNetwork(NetworkId.NONE,
TenantId.tenantId(tenantIdValue1));
manager.createVirtualDevice(virtualNetwork.id(), DID1);
}
示例5: testCreateVirtualHostWithNoNetwork
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
/**
* Tests adding a virtual host where no virtual network exists.
*/
@Test(expected = IllegalStateException.class)
public void testCreateVirtualHostWithNoNetwork() {
manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
VirtualNetwork virtualNetwork =
new DefaultVirtualNetwork(NetworkId.NONE, TenantId.tenantId(tenantIdValue1));
manager.createVirtualHost(virtualNetwork.id(), HID1, null, null, null, null);
}
示例6: network
import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; //导入依赖的package包/类
private VirtualNetwork network(int networkID, String tenantID) {
return new DefaultVirtualNetwork(NetworkId.networkId(networkID), TenantId.tenantId(tenantID));
}