本文整理匯總了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));
}