ONOS链路发现源码

2023-05-16

ONOS链路发现源码

    //send LLDP by ynogpu
    private void sendProbes(Long portNumber, String portDesc) {
        if (context.packetService() == null) {
            return;
        }
        OutboundPacket pkt = createOutBoundLldp(portNumber, portDesc);
        context.packetService().emit(pkt);
        if (context.useBddp()) {
            OutboundPacket bpkt = createOutBoundBddp(portNumber, portDesc);
            context.packetService().emit(bpkt);
        }
    }

----------------------------------------------------------------------------
----------------------------------------------------------------------------

    /**
     * Creates packet_out LLDP for specified output port.
     * @param portNumber the port
     * @param portDesc the port description
     * @return Packet_out message with LLDP data
     */
    //为指定的输出端口创建packet_out LLDP
    private OutboundPacket createOutBoundLldp(Long portNumber, String portDesc) { 
        log.info("yongpu-----createOutBoundLldp{}@{}",portNumber,portDesc);
        if (portNumber == null) {
            return null;
        }
        ONOSLLDP lldp = getLinkProbe(context.deviceService().getDevice(device.id()).chassisId(),
                portNumber, portDesc);
        ethPacket.setSourceMACAddress(context.fingerprint()).setPayload(lldp);
        return new DefaultOutboundPacket(device.id(),
                                         builder().setOutput(portNumber(portNumber)).build(),
                                         ByteBuffer.wrap(ethPacket.serialize()));
    }

  private ONOSLLDP getLinkProbe(ChassisId chassisId, Long portNumber, String portDesc) {
        return ONOSLLDP.onosLLDP(device.id().toString(), chassisId, portNumber.intValue(), portDesc);
}

----------------------------------------------------------------------------
----------------------------------------------------------------------------

/**
     * Creates a link probe for link discovery/verification.
     * @param deviceId The device ID as a String
     * @param chassisId The chassis ID of the device
     * @param portNum Port number of port to send probe out of
     * @param portDesc Port description of port to send probe out of
     * @return ONOSLLDP probe message
     */
    public static ONOSLLDP onosLLDP(String deviceId, ChassisId chassisId, int portNum, String portDesc) {
        ONOSLLDP probe = onosLLDP(deviceId, chassisId, portNum);

        if (portDesc != null && !portDesc.isEmpty()) {
            byte[] bPortDesc = portDesc.getBytes(StandardCharsets.UTF_8);

            if (bPortDesc.length > LLDPTLV.MAX_LENGTH) {
                bPortDesc = Arrays.copyOf(bPortDesc, LLDPTLV.MAX_LENGTH);
            }
            LLDPTLV portDescTlv = new LLDPTLV()
                    .setType(PORT_DESC_TLV_TYPE)
                    .setLength((short) bPortDesc.length)
                    .setValue(bPortDesc);
            probe.addOptionalTLV(portDescTlv);
        }
        return probe;
    }

----------------------------------------------------------------------------
----------------------------------------------------------------------------

  /**
     * Creates a link probe for link discovery/verification.
     * @param deviceId The device ID as a String
     * @param chassisId The chassis ID of the device
     * @param portNum Port number of port to send probe out of
     * @return ONOSLLDP probe message
     */
    public static ONOSLLDP onosLLDP(String deviceId, ChassisId chassisId, int portNum) {
        ONOSLLDP probe = new ONOSLLDP(NAME_SUBTYPE, DEVICE_SUBTYPE);
        probe.setPortId(portNum);
        probe.setDevice(deviceId);
        probe.setChassisId(chassisId);
        return probe;
    }

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ONOS链路发现源码 的相关文章

  • Ubuntu 16.04 安装onos 2.2.0

    之前使用了别人分享的安装好的p4虚拟机 xff0c 应该是这个人的 xff0c 不过我记得的是用的谷永普的 xff0c 当时还是从微云上下载的 xff0c 但是找不到了 不过无所谓 xff0c 本文不讲p4的安装 xff0c 有需要的 xf
  • 【SDN控制器分析之一】ONOS架构概述

    ONOS 设计目标 ONOS是一个采用OSGI技术来管理子项目的SDN控制器开源项目 xff0c 在最初设计时有这么几个目标是明确的 xff1a 代码模块化 xff1a 支持把新的功能作为新的独立单元引入特性可配置 xff1a 无论是在启动
  • onos实现driver的自动加载

    AbstractDriverLoader 已知driverAdminServer 根据path读取配置文件的内容 1 进入到XMLDriverLoader里 xff0c 根据XML 创建Provider gt XMLDriverLoader
  • ONOS之开放分布式SDN操作系统

    为什么80 的码农都做不了架构师 xff1f gt gt gt 关于构建ONOS xff08 开放式网络操作系统 xff09 的项目专题 xff0c 是通过性能激发创建的实验性分布式 SDN 控制平台 xff0c 满足大型运营商网络的可扩展
  • ONOS高可用性和可扩展性实现初探

    为什么80 的码农都做不了架构师 xff1f gt gt gt ONOS 的发布直面OpenDaylight 进行挑战 xff0c 直接将 SDN 领域两大阵营 xff08 运营商和设备商 xff09 的竞争瞬间升级 xff0c 之所以 O
  • ONOS预热篇之ONOS简介

    为什么80 的码农都做不了架构师 xff1f gt gt gt ONOS问世后引起广泛关注 xff0c 关于 ONOS 与 ODL 的纷争不绝于耳 xff0c 最近小编拜读了一下 ONOS 白皮书 xff0c 并做了一点粗浅总结 xff0c
  • ONOS意图框架

    1 意图基本概念 Intent是用于描述应用需求的不可变模型对象 xff0c ONOS核心根据其改变网络行为 在最低级别上 xff0c 可以用以下方式描述意图 即意图的组成 xff1a 1 Network Resource xff1a 一组
  • ONOS-ifwd-app源码分析总结

    ONOS ifwd源码分析 xff0c 参考资料 xff1a https www sdnlab com 10297 html 在之前的文章中 xff0c 介绍了ONOS sample apps的获取 xff0c 但是将其生成的oar文件导入
  • ONOS简介

    一 与ODL区别 ONOS与OpenDayLight 两个控制器之间的较量 ODL 立场 xff1a 设备厂商 xff1a Cisco Citrix Systems Red Hat Brocade Ericsson ClearPath HP
  • 集群源码安装ONOS

    集群源码安装ONOS 1 每一台待安装onos的配置 bin bash sudo mv apache karaf 3 0 3 tar gz opt sudo mv apache maven 3 3 1 bin tar gz opt cd o
  • ONOS源码笔记--机制

    app注册 private ApplicationId appId appId 61 coreService registerApplication 34 org onosproject fwd 34 注册应用 xff0c 一般在activ
  • 使用ONOS的REST API来下发流表

    1 启动ONOS后 xff0c 浏览器进入doc http 10 109 247 211 8181 onos v1 docs 2 找到Flow xff0c 并打开POST 3 可以直接在这个上面编辑flow stream里面模拟GET获得的
  • 从零开始安装ubuntu18+P4+ONOS

    1 安装VMware Tools xff08 前面VM虚拟机安装Ubuntu的教程太多 xff0c 就不写了 xff09 先从虚拟机下载好 xff0c 然后将压缩包里的文件夹移动出来 xff08 可以用解压或者直接点开压缩包 xff0c 移
  • ONOS 控制器安装和app新建和编译

    1 1 ONOS 控制器编译与安装 ONOS 1 8 版本起强制使用 BUCK 构建工具 xff0c 不再使用 maven xff0c 编译和打包方式与旧版本有所区别 步骤 xff1a 配置环境 gt 下代码 gt 编译 gt 运行 配置环
  • Mininet连接ONOS的一些问题

    Mininet连接ONOS的一些问题 一 启动ONOS二 简单小问题1 Mininet创建最简拓扑后连接不上远程控制器2 Mininet创建最简拓扑后主机之间ping不通3 不启动fwd应用自己通过REST API下发流表发现两台主机间pi
  • Ubuntu Server 14.04部署ONOS

    参考官网 xff1a https wiki onosproject org display ONOS Installing 43 and 43 Running 43 ONOS 由于笔者习惯ssh xff0c ubuntu默认没有开启ssh
  • P4连接ONOS——导入ONOS虚拟机

    补充 xff1a 2020年5月11日 13点07分 近期有同学私信我安装过程中有这个报错 xff0c 如下图 根据报错信息 xff0c 似乎是下载这个包服务器501出错 xff0c 很可能是因为内网无法下载这个包 我忘记说了 xff0c
  • ONOS链路发现源码

    ONOS链路发现源码 send LLDP by ynogpu private void sendProbes Long portNumber String portDesc if context packetService 61 61 nu
  • Ubuntu16.04下基于BUCK安装onos

    踩了很多坑 xff0c 其中很多错误也没整明白怎么回事 xff0c 实在搞不了就重装系统 xff0c 经过多次测试 xff0c 找到了一个合适的安装步骤安装ONNO 1 13 2 1 安装mininet 需要可以安装 xff09 此步骤安装
  • java.lang.NoSuchFieldError:DEF_CONTENT_CHARSET

    我正在尝试运行 java 程序 但收到以下运行时错误 错误如下所示 Exception in thread main java lang NoSuchFieldError DEF CONTENT CHARSET at org apache

随机推荐