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


Java MulticastRouteService类代码示例

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


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

示例1: createRoute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
/**
 * Create new multicast route.
 * Creates a new route in the multicast RIB.
 *
 * @onos.rsModel McastRoutePost
 * @param stream multicast route JSON
 * @return status of the request - CREATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createRoute(InputStream stream) {
    MulticastRouteService service = get(MulticastRouteService.class);
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        McastRoute route = codec(McastRoute.class).decode(jsonTree, this);
        service.add(route);
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }

    return Response
            .created(URI.create(""))
            .build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:MulticastRouteWebResource.java

示例2: execute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Override
protected void execute() {
    MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);

    //McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr);
    McastRoute mRoute = new McastRoute(IpAddress.valueOf(sAddr),
            IpAddress.valueOf(gAddr), McastRoute.Type.STATIC);
    mcastRouteManager.add(mRoute);

    if (ingressPort != null) {
        ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressPort);
        mcastRouteManager.addSource(mRoute, ingress);
    }

    if (ports != null) {
        for (String egCP : ports) {
            log.debug("Egress port provided: " + egCP);
            ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP);
            mcastRouteManager.addSink(mRoute, egress);

        }
    }
    print("Added the mcast route: %s", mRoute);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:McastJoinCommand.java

示例3: execute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Override
protected void execute() {
    MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);

    if (sAddr.equals("*") && gAddr.equals("*")) {
        // Clear all routes
        mcastRouteManager.getRoutes().forEach(mcastRouteManager::remove);
        return;
    }

    McastRoute mRoute = new McastRoute(IpAddress.valueOf(sAddr),
            IpAddress.valueOf(gAddr), McastRoute.Type.STATIC);

    if (egressList == null) {
        mcastRouteManager.remove(mRoute);
    } else {
        // check list for validity before we begin to delete.
        for (String egress : egressList) {
            ConnectPoint eCp = ConnectPoint.deviceConnectPoint(egress);
            mcastRouteManager.removeSink(mRoute, eCp);
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:McastDeleteCommand.java

示例4: createRoute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
/**
 * Create new multicast route.
 * Creates a new route in the multicast RIB.
 *
 * @onos.rsModel McastRoutePost
 * @param stream multicast route JSON
 * @return status of the request - CREATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createRoute(InputStream stream) {

    final String ingressStr = "ingress";
    MulticastRouteService service = get(MulticastRouteService.class);
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        McastRoute route = codec(McastRoute.class).decode(jsonTree, this);
        service.add(route);
        if (jsonTree.has(ingressStr)) {
            String ingressPathStr = jsonTree.path(ingressStr).asText();
            ConnectPoint ingressConnectPoint = nullIsNotFound(ConnectPoint.deviceConnectPoint(ingressPathStr),
                                                              "ingress connection point cannot be null!");
            service.addSource(route, ingressConnectPoint);
        }
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }

    return Response
            .created(URI.create(""))
            .build();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:35,代码来源:MulticastRouteWebResource.java

示例5: addSinks

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
/**
 * Create a sink for a multicast route.
 * Creates a new sink for an existing multicast route.
 *
 * @onos.rsModel McastSinkPost
 * @param group group IP address
 * @param source source IP address
 * @param stream sink JSON
 * @return status of the request - CREATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("sinks/{group}/{source}")
public Response addSinks(@PathParam("group") String group,
                         @PathParam("source") String source,
                         InputStream stream) {
    MulticastRouteService service = get(MulticastRouteService.class);
    try {
        McastRoute route = new McastRoute(IpAddress.valueOf(source), IpAddress.valueOf(group),
                McastRoute.Type.STATIC);
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);

        jsonTree.path("sinks").forEach(node -> {
            ConnectPoint sink = ConnectPoint.deviceConnectPoint(node.asText());
            service.addSink(route, sink);
        });
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }

    return Response
            .created(URI.create(""))
            .build();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:37,代码来源:MulticastRouteWebResource.java

示例6: execute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Override
protected void execute() {
    MulticastRouteService mcastRouteManager = get(MulticastRouteService.class);

    if ("*".equals(sAddr) && "*".equals(gAddr)) {
        // Clear all routes
        mcastRouteManager.getRoutes().forEach(mcastRouteManager::remove);
        return;
    }

    McastRoute mRoute = new McastRoute(IpAddress.valueOf(sAddr),
            IpAddress.valueOf(gAddr), McastRoute.Type.STATIC);

    if (egressList == null) {
        mcastRouteManager.remove(mRoute);
    } else {
        // check list for validity before we begin to delete.
        for (String egress : egressList) {
            ConnectPoint eCp = ConnectPoint.deviceConnectPoint(egress);
            mcastRouteManager.removeSink(mRoute, eCp);
        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:24,代码来源:McastDeleteCommand.java

示例7: getRoutes

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
/**
 * Get all multicast routes.
 * Returns array of all known multicast routes.
 *
 * @return 200 OK with array of all known multicast routes
 * @onos.rsModel McastRoutesGet
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getRoutes() {
    Set<McastRoute> routes = get(MulticastRouteService.class).getRoutes();
    ObjectNode root = encodeArray(McastRoute.class, "routes", routes);
    return ok(root).build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:MulticastRouteWebResource.java

示例8: deleteRoute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
/**
 * Remove a multicast route.
 * Removes a route from the multicast RIB.
 *
 * @param stream multicast route JSON
 * @return 204 NO CONTENT
 * @onos.rsModel McastRoutePost
 */
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
public Response deleteRoute(InputStream stream) {
    MulticastRouteService service = get(MulticastRouteService.class);
    try {
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        McastRoute route = codec(McastRoute.class).decode(jsonTree, this);
        service.remove(route);
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }
    return Response.noContent().build();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:MulticastRouteWebResource.java

示例9: setupTest

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Before
public void setupTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();

    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(MulticastRouteService.class, mockMulticastRouteService)
                    .add(CodecService.class, codecService);
    BaseResource.setServiceDirectory(testDirectory);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:MulticastRouteResourceTest.java

示例10: execute

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Override
protected void execute() {
    MulticastRouteService mcastService = get(MulticastRouteService.class);

    Set<McastRoute> routes = mcastService.getRoutes();

    for (McastRoute route : routes) {
        Set<ConnectPoint> sinks = mcastService.fetchSinks(route);
        ConnectPoint source = mcastService.fetchSource(route);

        print(FORMAT, route, source, sinks);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:McastShowCommand.java

示例11: setupTest

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
@Before
public void setupTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();

    ServiceDirectory testDirectory =
            new TestServiceDirectory()
                    .add(MulticastRouteService.class, mockMulticastRouteService)
                    .add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:12,代码来源:MulticastRouteResourceTest.java

示例12: MulticastRouteGrpcService

import org.onosproject.net.mcast.MulticastRouteService; //导入依赖的package包/类
public MulticastRouteGrpcService(MulticastRouteService service) {
    this.multicastRouteService = service;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:4,代码来源:MulticastRouteGrpcService.java


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