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


Java VirtualPortService类代码示例

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


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

示例1: modifyHostDetails

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@Override
public void modifyHostDetails(PropertyPanel pp, HostId hostId) {
    pp.title(MY_HOST_TITLE);
    pp.removeAllProps();
    PortPairService portPairService = AbstractShellCommand.get(PortPairService.class);
    VirtualPortService virtualPortService = AbstractShellCommand.get(VirtualPortService.class);
    HostService hostService = AbstractShellCommand.get(HostService.class);
    Iterable<PortPair> portPairs = portPairService.getPortPairs();
    for (PortPair portPair : portPairs) {
        VirtualPort vPort = virtualPortService.getPort(VirtualPortId.portId(portPair.ingress()));
        MacAddress dstMacAddress = vPort.macAddress();
        Host host = hostService.getHost(HostId.hostId(dstMacAddress));
        if (hostId.toString().equals(host.id().toString())) {
            pp.addProp("SF Name", portPair.name());
            pp.addProp("SF Ip", vPort.fixedIps().iterator().next().ip());
        }
    }
    pp.addProp("SF host Address", hostId.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:SfcwebUiTopovOverlay.java

示例2: createExGwPort

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:VirtualPortExGwUpdateCommand.java

示例3: updateExGwPort

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
private void updateExGwPort(VirtualPort exgwPort) {
    VirtualPortService service = get(VirtualPortService.class);
    Map<String, String> strMap = Maps.newHashMap();
    strMap.putIfAbsent("name", exgwPort.name());
    strMap.putIfAbsent("deviceOwner", exgwPort.deviceOwner());
    strMap.putIfAbsent("bindingvnicType", exgwPort.bindingVnicType());
    strMap.putIfAbsent("bindingvifType", exgwPort.bindingVifType());
    strMap.putIfAbsent("bindingvnicDetails", exgwPort.bindingVifDetails());
    VirtualPort virtualPort = new DefaultVirtualPort(exgwPort.portId(),
                                                     exgwPort.networkId(),
                                                     false, strMap,
                                                     VirtualPort.State.DOWN,
                                                     MacAddress.valueOf(macAddress),
                                                     exgwPort.tenantId(),
                                                     exgwPort.deviceId(),
                                                     exgwPort.fixedIps(),
                                                     exgwPort.bindingHostId(),
                                                     Sets.newHashSet(exgwPort
                                                            .allowedAddressPairs()),
                                                     Sets.newHashSet(exgwPort
                                                            .securityGroups()));
    Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
    service.updatePorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:VirtualPortExGwUpdateCommand.java

示例4: execute

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortCreateCommand.java

示例5: execute

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:VirtualPortUpdateCommand.java

示例6: getportsById

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getportsById(@PathParam("id") String id) {

    if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) {
        return Response.status(NOT_FOUND)
                .entity(VPORT_NOT_FOUND).build();
    }
    VirtualPort virtualPort = nullIsNotFound(get(VirtualPortService.class)
            .getPort(VirtualPortId.portId(id)), VPORT_NOT_FOUND);
    ObjectNode result = new ObjectMapper().createObjectNode();
    result.set("port", new VirtualPortCodec().encode(virtualPort, this));
    return ok(result.toString()).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:VirtualPortWebResource.java

示例7: createPorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createPorts(InputStream input) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode cfg = mapper.readTree(input);
        Iterable<VirtualPort> vPorts = createOrUpdateByInputStream(cfg);
        Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
                .createPorts(vPorts), VPORT_NOT_FOUND);
        if (!issuccess) {
            return Response.status(INTERNAL_SERVER_ERROR)
                    .entity(VPORT_ID_NOT_EXIST).build();
        }
        return Response.status(OK).entity(issuccess.toString()).build();
    } catch (Exception e) {
        log.error("Creates VirtualPort failed because of exception {}",
                  e.toString());
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:VirtualPortWebResource.java

示例8: deletePorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@DELETE
@Path("{portUUID}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deletePorts(@PathParam("portUUID") String id) {
    Set<VirtualPortId> vPortIds = new HashSet<>();
    try {
        if (id != null) {
            vPortIds.add(VirtualPortId.portId(id));
        }
        Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
                .removePorts(vPortIds), VPORT_NOT_FOUND);
        if (!issuccess) {
            return Response.status(INTERNAL_SERVER_ERROR)
                    .entity(VPORT_ID_NOT_EXIST).build();
        }
        return ok(issuccess.toString()).build();
    } catch (Exception e) {
        log.error("Deletes VirtualPort failed because of exception {}",
                  e.toString());
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:VirtualPortWebResource.java

示例9: updatePorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@PUT
@Path("{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updatePorts(@PathParam("id") String id, InputStream input) {
    try {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode cfg = mapper.readTree(input);
        Iterable<VirtualPort> vPorts = createOrUpdateByInputStream(cfg);
        Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
                .updatePorts(vPorts), VPORT_NOT_FOUND);
        if (!issuccess) {
            return Response.status(INTERNAL_SERVER_ERROR)
                    .entity(VPORT_ID_NOT_EXIST).build();
        }
        return Response.status(OK).entity(issuccess.toString()).build();
    } catch (Exception e) {
        log.error("Updates failed because of exception {}", e.toString());
        return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
                .build();
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:VirtualPortWebResource.java

示例10: sfcPorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
    List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
    PortPairGroupService ppgs = get(PortPairGroupService.class);
    PortPairService pps = get(PortPairService.class);
    VirtualPortService vps = get(VirtualPortService.class);
    List<VirtualPort> vpList = new ArrayList<VirtualPort>();
    if (portPairGroupList != null) {
        portPairGroupList.stream().forEach(ppgid -> {
            PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
            List<PortPairId> portPairList = ppg.portPairs();
            if (portPairList != null) {
                portPairList.stream().forEach(ppid -> {
                    PortPair pp = pps.getPortPair(ppid);
                    VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
                    vpList.add(vp);
                });
            }
        });
    }
    return vpList;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:SfcViewMessageHandler.java

示例11: SfcFlowRuleInstallerImpl

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
/**
 * Explicit constructor.
 *
 * @param appId application id.
 */
public SfcFlowRuleInstallerImpl(ApplicationId appId) {
    this.appId = checkNotNull(appId, "ApplicationId can not be null");
    ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
    this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
    this.driverService = serviceDirectory.get(DriverService.class);
    this.deviceService = serviceDirectory.get(DeviceService.class);
    this.hostService = serviceDirectory.get(HostService.class);
    this.virtualPortService = serviceDirectory.get(VirtualPortService.class);
    this.vtnRscService = serviceDirectory.get(VtnRscService.class);
    this.portPairService = serviceDirectory.get(PortPairService.class);
    this.portPairGroupService = serviceDirectory.get(PortPairGroupService.class);
    this.flowClassifierService = serviceDirectory.get(FlowClassifierService.class);
    this.tenantNetworkService = serviceDirectory.get(TenantNetworkService.class);
    nshSi = 0xff;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:SfcFlowRuleInstallerImpl.java

示例12: sfcPorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
private List<VirtualPort> sfcPorts(PortChain pchain) {
    List<PortPairGroupId> portPairGroupList = pchain.portPairGroups();
    PortPairGroupService ppgs = get(PortPairGroupService.class);
    PortPairService pps = get(PortPairService.class);
    VirtualPortService vps = get(VirtualPortService.class);
    List<VirtualPort> vpList = new ArrayList<VirtualPort>();
    if (portPairGroupList != null) {
        portPairGroupList.forEach(ppgid -> {
            PortPairGroup ppg = ppgs.getPortPairGroup(ppgid);
            List<PortPairId> portPairList = ppg.portPairs();
            if (portPairList != null) {
                portPairList.forEach(ppid -> {
                    PortPair pp = pps.getPortPair(ppid);
                    VirtualPort vp = vps.getPort(VirtualPortId.portId(pp.ingress()));
                    vpList.add(vp);
                });
            }
        });
    }
    return vpList;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:22,代码来源:SfcViewMessageHandler.java

示例13: execute

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@Override
protected void execute() {
    VirtualPortService service = get(VirtualPortService.class);
    SubnetService subnetService = get(SubnetService.class);
    TenantNetworkService tenantNetworkService = get(TenantNetworkService.class);
    Iterable<TenantNetwork> networks = tenantNetworkService.getNetworks();
    if (networks != null) {
        for (TenantNetwork network : networks) {
            if (network.routerExternal()) {
                Iterable<Subnet> subnets = subnetService.getSubnets();
                if (subnets != null) {
                    for (Subnet subnet : subnets) {
                        if (network.id().networkId().equals(subnet.networkId().networkId())) {
                            IpAddress exgwip = subnet.gatewayIp();
                            FixedIp fixedGwIp = FixedIp.fixedIp(subnet.id(), exgwip);
                            VirtualPort exgwPort = service.getPort(fixedGwIp);
                            if (exgwPort == null) {
                                createExGwPort(network, subnet, fixedGwIp);
                            } else {
                                updateExGwPort(exgwPort);
                            }
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:VirtualPortExGwUpdateCommand.java

示例14: getPorts

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getPorts() {
    Iterable<VirtualPort> virtualPorts = get(VirtualPortService.class)
            .getPorts();
    ObjectNode result = new ObjectMapper().createObjectNode();
    result.set("ports", new VirtualPortCodec().encode(virtualPorts, this));
    return ok(result.toString()).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:VirtualPortWebResource.java

示例15: execute

import org.onosproject.vtnrsc.virtualport.VirtualPortService; //导入依赖的package包/类
@Override
protected void execute() {
    VirtualPortService service = get(VirtualPortService.class);
    Set<VirtualPortId> virtualPorts = Sets.newHashSet(VirtualPortId.portId(id));
    service.removePorts(virtualPorts);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:7,代码来源:VirtualPortRemoveCommand.java


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