当前位置: 首页>>代码示例>>Java>>正文


Java VirtualNetworkService类代码示例

本文整理汇总了Java中org.onosproject.incubator.net.virtual.VirtualNetworkService的典型用法代码示例。如果您正苦于以下问题:Java VirtualNetworkService类的具体用法?Java VirtualNetworkService怎么用?Java VirtualNetworkService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VirtualNetworkService类属于org.onosproject.incubator.net.virtual包,在下文中一共展示了VirtualNetworkService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decode

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
@Override
public VirtualPort decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
    DeviceId dId = DeviceId.deviceId(extractMember(DEVICE_ID, json));

    VirtualNetworkService vnetService = context.getService(VirtualNetworkService.class);
    Set<VirtualDevice> vDevs = vnetService.getVirtualDevices(nId);
    VirtualDevice vDev = vDevs.stream()
            .filter(virtualDevice -> virtualDevice.id().equals(dId))
            .findFirst().orElse(null);
    nullIsIllegal(vDev, dId.toString() + INVALID_VIRTUAL_DEVICE);

    PortNumber portNum = PortNumber.portNumber(extractMember(PORT_NUM, json));
    DeviceId physDId = DeviceId.deviceId(extractMember(PHYS_DEVICE_ID, json));
    PortNumber physPortNum = PortNumber.portNumber(extractMember(PHYS_PORT_NUM, json));

    DefaultAnnotations annotations = DefaultAnnotations.builder().build();
    Device physDevice = new DefaultDevice(null, physDId,
            null, null, null, null, null, null, annotations);
    Port realizedBy = new DefaultPort(physDevice, physPortNum, true);
    return new DefaultVirtualPort(nId, vDev, portNum, realizedBy);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:VirtualPortCodec.java

示例2: setUp

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
@Before
public void setUp() {
    VirtualNetworkService manager = new TestVirtualNetworkManager();

    dispatcher.addSink(VirtualEvent.class, listenerRegistryManager);

    prickleListener = new PrickleListener();
    prickleManager = new PrickleManager(manager, NetworkId.networkId(1));
    prickleManager.addListener(prickleListener);

    gooListener = new GooListener();
    gooManager = new GooManager(manager, NetworkId.networkId(1));
    gooManager.addListener(gooListener);

    barListener = new BarListener();
    barManager = new BarManager(manager, NetworkId.networkId(2));
    barManager.addListener(barListener);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:AbstractVirtualListenerManagerTest.java

示例3: VirtualNetworkPacketManager

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
public VirtualNetworkPacketManager(VirtualNetworkService virtualNetworkManager,
                                   NetworkId networkId) {
    super(virtualNetworkManager, networkId);
    this.manager = virtualNetworkManager;

    //Set node id as same as the node hosting virtual manager
    ClusterService clusterService = serviceDirectory.get(ClusterService.class);
    this.localNodeId = clusterService.getLocalNode().id();

    this.store = serviceDirectory.get(VirtualNetworkPacketStore.class);
    this.store.setDelegate(networkId(), new InternalStoreDelegate());

    this.deviceService = manager.get(networkId(), DeviceService.class);
    this.objectiveService = manager.get(networkId(), FlowObjectiveService.class);

    providerRegistryService =
            serviceDirectory.get(VirtualProviderRegistryService.class);
    providerService = new InternalPacketProviderService();
    providerRegistryService.registerProviderService(networkId(), providerService);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:21,代码来源:VirtualNetworkPacketManager.java

示例4: VirtualNetworkGroupManager

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
public VirtualNetworkGroupManager(VirtualNetworkService manager, NetworkId networkId) {
    super(manager, networkId, GroupEvent.class);

    store = serviceDirectory.get(VirtualNetworkGroupStore.class);
    deviceService = manager.get(networkId, DeviceService.class);

    providerRegistryService =
            serviceDirectory.get(VirtualProviderRegistryService.class);
    innerProviderService = new InternalGroupProviderService();
    providerRegistryService.registerProviderService(networkId(), innerProviderService);

    this.storeDelegate = new InternalStoreDelegate();
    store.setDelegate(networkId, this.storeDelegate);

    log.info("Started");
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:VirtualNetworkGroupManager.java

示例5: VirtualNetworkFlowRuleManager

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Creates a new VirtualNetworkFlowRuleService object.
 *
 * @param virtualNetworkManager virtual network manager service
 * @param networkId a virtual network identifier
 */
public VirtualNetworkFlowRuleManager(VirtualNetworkService virtualNetworkManager,
                                     NetworkId networkId) {
    super(virtualNetworkManager, networkId, FlowRuleEvent.class);

    store = serviceDirectory.get(VirtualNetworkFlowRuleStore.class);

    idGenerator = serviceDirectory.get(CoreService.class)
            .getIdGenerator(VIRTUAL_FLOW_OP_TOPIC + networkId().toString());
    providerRegistryService =
            serviceDirectory.get(VirtualProviderRegistryService.class);
    innerProviderService = new InternalFlowRuleProviderService();
    providerRegistryService.registerProviderService(networkId(), innerProviderService);

    this.deviceService = manager.get(networkId, DeviceService.class);
    this.storeDelegate = new InternalStoreDelegate();
    store.setDelegate(networkId, this.storeDelegate);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:24,代码来源:VirtualNetworkFlowRuleManager.java

示例6: execute

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
@Override
protected void execute() {
    CoreService coreService = get(CoreService.class);

    VirtualNetworkService vnetservice = get(VirtualNetworkService.class);
    DeviceService deviceService = vnetservice.get(NetworkId.networkId(networkId),
                                                  DeviceService.class);
    FlowRuleService service = vnetservice.get(NetworkId.networkId(networkId),
                                              FlowRuleService.class);
    contentFilter = new StringFilter(filter, StringFilter.Strategy.AND);

    compilePredicate();

    SortedMap<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service);

    if (outputJson()) {
        print("%s", json(flows.keySet(), flows));
    } else {
        flows.forEach((device, flow) -> printFlows(device, flow, coreService));
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:VirtualFlowsListCommand.java

示例7: DefaultOFSwitch

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
private DefaultOFSwitch(DatapathId dpid, OFSwitchCapabilities capabilities,
                        NetworkId networkId, DeviceId deviceId,
                        ServiceDirectory serviceDirectory) {
    this.dpId = dpid;
    this.capabilities = capabilities;
    this.networkId = networkId;
    this.deviceId = deviceId;
    this.ofSwitchService = serviceDirectory.get(OFSwitchService.class);
    this.driverService = serviceDirectory.get(DriverService.class);
    this.virtualNetworkAdminService = serviceDirectory.get(VirtualNetworkAdminService.class);
    VirtualNetworkService virtualNetworkService = serviceDirectory.get(VirtualNetworkService.class);
    this.flowRuleService = virtualNetworkService.get(networkId, FlowRuleService.class);
    this.groupService = virtualNetworkService.get(networkId, GroupService.class);
    this.meterService = virtualNetworkService.get(networkId, MeterService.class);

    log = LoggerFactory.getLogger(OFAgent.TRACER_LOG_TENANT_ID_PREFIX + virtualNetworkService.getTenantId(networkId)
                                          + " " + getClass().getSimpleName() + " : " + dpid);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:19,代码来源:DefaultOFSwitch.java

示例8: execute

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
@Override
protected void execute() {
    Set<OFController> ctrls = Sets.newHashSet();
    for (String strCtrl : strCtrls) {
        if (!isValidController(strCtrl)) {
            print("Invalid controller %s, ignores it.", strCtrl);
            continue;
        }
        String[] temp = strCtrl.split(":");
        ctrls.add(DefaultOFController.of(IpAddress.valueOf(temp[0]),
                TpPort.tpPort(Integer.valueOf(temp[1]))));
    }

    VirtualNetworkService virtualNetworkService = get(VirtualNetworkService.class);
    TenantId tenantId = virtualNetworkService.getTenantId(NetworkId.networkId(networkId));
    checkNotNull(tenantId, "Virtual network %s does not have tenant.", networkId);
    OFAgentAdminService adminService = get(OFAgentAdminService.class);
    OFAgent ofAgent = DefaultOFAgent.builder()
            .networkId(NetworkId.networkId(networkId))
            .tenantId(tenantId)
            .controllers(ctrls)
            .state(OFAgent.State.STOPPED)
            .build();
    adminService.createAgent(ofAgent);
    print("Successfully created OFAgent for network %s, tenant %s", networkId, tenantId);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:27,代码来源:OFAgentCreateCommand.java

示例9: decode

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
@Override
public VirtualPort decode(ObjectNode json, CodecContext context) {
    if (json == null || !json.isObject()) {
        return null;
    }

    NetworkId nId = NetworkId.networkId(Long.parseLong(extractMember(NETWORK_ID, json)));
    DeviceId dId = DeviceId.deviceId(extractMember(DEVICE_ID, json));

    VirtualNetworkService vnetService = context.getService(VirtualNetworkService.class);
    Set<VirtualDevice> vDevs = vnetService.getVirtualDevices(nId);
    VirtualDevice vDev = vDevs.stream()
            .filter(virtualDevice -> virtualDevice.id().equals(dId))
            .findFirst().orElse(null);
    nullIsIllegal(vDev, dId.toString() + INVALID_VIRTUAL_DEVICE);

    PortNumber portNum = PortNumber.portNumber(extractMember(PORT_NUM, json));
    DeviceId physDId = DeviceId.deviceId(extractMember(PHYS_DEVICE_ID, json));
    PortNumber physPortNum = PortNumber.portNumber(extractMember(PHYS_PORT_NUM, json));

    ConnectPoint realizedBy = new ConnectPoint(physDId, physPortNum);
    return new DefaultVirtualPort(nId, vDev, portNum, realizedBy);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:24,代码来源:VirtualPortCodec.java

示例10: setUpTest

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    // Register the services needed for the test
    codecService = new CodecManager();
    codecService.activate();
    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(VirtualNetworkAdminService.class, mockVnetAdminService)
                    .add(VirtualNetworkService.class, mockVnetService)
                    .add(CodecService.class, codecService);

    BaseResource.setServiceDirectory(testDirectory);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:VirtualNetworkWebResourceTest.java

示例11: getSortedVirtualDevices

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Returns the list of virtual devices sorted using the device identifier.
 *
 * @return sorted virtual device list
 */
private List<VirtualDevice> getSortedVirtualDevices() {
    VirtualNetworkService service = get(VirtualNetworkService.class);

    List<VirtualDevice> virtualDevices = new ArrayList<>();
    virtualDevices.addAll(service.getVirtualDevices(NetworkId.networkId(networkId)));
    Collections.sort(virtualDevices, Comparators.VIRTUAL_DEVICE_COMPARATOR);
    return virtualDevices;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:VirtualDeviceListCommand.java

示例12: getSortedVirtualPorts

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Returns the list of virtual ports sorted using the network identifier.
 *
 * @return sorted virtual port list
 */
private List<VirtualPort> getSortedVirtualPorts() {
    VirtualNetworkService service = get(VirtualNetworkService.class);

    List<VirtualPort> virtualPorts = new ArrayList<>();
    virtualPorts.addAll(service.getVirtualPorts(NetworkId.networkId(networkId), DeviceId.deviceId(deviceId)));
    Collections.sort(virtualPorts, Comparators.VIRTUAL_PORT_COMPARATOR);
    return virtualPorts;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:VirtualPortListCommand.java

示例13: getVirtualDevice

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Returns the virtual device matching the device identifier.
 *
 * @param aDeviceId device identifier
 * @return matching virtual device, or null.
 */
private VirtualDevice getVirtualDevice(DeviceId aDeviceId) {
    VirtualNetworkService service = get(VirtualNetworkService.class);

    Set<VirtualDevice> virtualDevices = service.getVirtualDevices(NetworkId.networkId(networkId));

    for (VirtualDevice virtualDevice : virtualDevices) {
        if (virtualDevice.id().equals(aDeviceId)) {
            return virtualDevice;
        }
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:VirtualPortCreateCommand.java

示例14: getSortedVirtualNetworks

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Returns the list of virtual networks sorted using the tenant identifier.
 *
 * @return sorted virtual network list
 */
private List<VirtualNetwork> getSortedVirtualNetworks() {
    VirtualNetworkService service = get(VirtualNetworkService.class);
    VirtualNetworkAdminService adminService = get(VirtualNetworkAdminService.class);

    List<VirtualNetwork> virtualNetworks = new ArrayList<>();

    Set<TenantId> tenantSet = adminService.getTenantIds();
    tenantSet.forEach(tenantId -> virtualNetworks.addAll(service.getVirtualNetworks(tenantId)));

    Collections.sort(virtualNetworks, Comparators.VIRTUAL_NETWORK_COMPARATOR);
    return virtualNetworks;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:VirtualNetworkListCommand.java

示例15: getSortedVirtualLinks

import org.onosproject.incubator.net.virtual.VirtualNetworkService; //导入依赖的package包/类
/**
 * Returns the list of virtual links sorted using the device identifier.
 *
 * @return virtual link list
 */
private List<VirtualLink> getSortedVirtualLinks() {
    VirtualNetworkService service = get(VirtualNetworkService.class);

    List<VirtualLink> virtualLinks = new ArrayList<>();
    virtualLinks.addAll(service.getVirtualLinks(NetworkId.networkId(networkId)));
    return virtualLinks;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:VirtualLinkListCommand.java


注:本文中的org.onosproject.incubator.net.virtual.VirtualNetworkService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。