生成Protobuf的Go代码
Protobuf生成Go代码插件 1. 安装protoc 首先protoc –version 查询本机版本。假设从protoc2更换到protoc3. 在官方Githubhttps://github.com/protocolbuffers/protobuf/下载地址找相应版本的源码。 [crayon-6519c83cd990a… 阅读更多 »生成Protobuf的Go代码
Protobuf生成Go代码插件 1. 安装protoc 首先protoc –version 查询本机版本。假设从protoc2更换到protoc3. 在官方Githubhttps://github.com/protocolbuffers/protobuf/下载地址找相应版本的源码。 [crayon-6519c83cd990a… 阅读更多 »生成Protobuf的Go代码
1. VPP 接口文件 vpp同控制平面交互的定义接口位于目录vpp/src/vnet和vpp/src/plugins中的api文件;例如src/vnet/ip/ip_types.api文件中定义实例如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
/* Hey Emacs use -*- mode: C -*- */ /* * Copyright (c) 2018 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ option version = "3.0.0"; manual_print typedef u8 ip4_address[4]; manual_print typedef u8 ip6_address[16]; enum address_family : u8 { ADDRESS_IP4 = 0, ADDRESS_IP6, }; /** * @brief The location at which to apply a feature */ enum ip_feature_location: u8 { IP_API_FEATURE_INPUT = 0, IP_API_FEATURE_OUTPUT, IP_API_FEATURE_LOCAL, IP_API_FEATURE_PUNT, IP_API_FEATURE_DROP, }; /* ECN code points - RFC 3168 https://tools.ietf.org/html/rfc3168 */ enum ip_ecn : u8 { IP_API_ECN_NONE = 0, IP_API_ECN_ECT0 = 1, IP_API_ECN_ECT1 = 2, IP_API_ECN_CE = 3, }; /* DSCP code points - RFC 2474 https://tools.ietf.org/html/rfc2474 Values other than these RFC defined values are accepted. */ enum ip_dscp : u8 { IP_API_DSCP_CS0 = 0, IP_API_DSCP_CS1 = 8, IP_API_DSCP_AF11 = 10, IP_API_DSCP_AF12 = 12, IP_API_DSCP_AF13 = 14, IP_API_DSCP_CS2 = 16, IP_API_DSCP_AF21 = 18, IP_API_DSCP_AF22 = 20, IP_API_DSCP_AF23 = 22, IP_API_DSCP_CS3 = 24, IP_API_DSCP_AF31 = 26, IP_API_DSCP_AF32 = 28, IP_API_DSCP_AF33 = 30, IP_API_DSCP_CS4 = 32, IP_API_DSCP_AF41 = 34, IP_API_DSCP_AF42 = 36, IP_API_DSCP_AF43 = 38, IP_API_DSCP_CS5 = 40, IP_API_DSCP_EF = 46, IP_API_DSCP_CS6 = 48, IP_API_DSCP_CS7 = 50, }; enum ip_proto : u8 { IP_API_PROTO_HOPOPT = 0, IP_API_PROTO_ICMP = 1, IP_API_PROTO_IGMP = 2, IP_API_PROTO_TCP = 6, IP_API_PROTO_UDP = 17, IP_API_PROTO_GRE = 47, IP_API_PROTO_ESP = 50, IP_API_PROTO_AH = 51, IP_API_PROTO_ICMP6 = 58, IP_API_PROTO_EIGRP = 88, IP_API_PROTO_OSPF = 89, IP_API_PROTO_SCTP = 132, IP_API_PROTO_RESERVED = 255, }; union address_union { vl_api_ip4_address_t ip4; vl_api_ip6_address_t ip6; }; manual_print typedef address { vl_api_address_family_t af; vl_api_address_union_t un; }; manual_print typedef prefix { vl_api_address_t address; u8 len; }; typedef ip4_address_and_mask { vl_api_ip4_address_t addr; vl_api_ip4_address_t mask; }; typedef ip6_address_and_mask { vl_api_ip6_address_t addr; vl_api_ip6_address_t mask; }; typedef mprefix { vl_api_address_family_t af; u16 grp_address_length; vl_api_address_union_t grp_address; vl_api_address_union_t src_address; }; manual_print typedef ip6_prefix { vl_api_ip6_address_t address; u8 len; }; manual_print typedef ip4_prefix { vl_api_ip4_address_t address; u8 len; }; /** \brief * * The vl_api_[ip4|ip6]_address_with_prefix_t types are used as a type to denote * both an IP address and a prefix. I.e. in CIDR notation * '192.168.10.1/24' the address is 192.168.10.1 and the network * prefix is 192.168.10.0/24. * * If only an address is needed use: vl_api_address_t types and if * only a network prefix is needed (i.e. no hosts bits), then use the * vl_api_prefix_t types. * **/ manual_print typedef vl_api_prefix_t address_with_prefix; manual_print typedef vl_api_ip4_prefix_t ip4_address_with_prefix; manual_print typedef vl_api_ip6_prefix_t ip6_address_with_prefix; /** \brief A context for matching prefixes against. (Think ip prefix list.) The meaning (exact match / want subnets) of an unset matcher is left to the implementer. @param le - le mut be <= to prefix.len. Default: 255 (not set). @param ge - ge must be greater than le and <= max_size of prefix. Default: 255 (not set). */ typedef prefix_matcher { u8 le; /* [default=255] */ u8 ge; /* [default=255] */ }; |
2. VPP 接口帮助文档 生成其他类型的接口文件,需要… 阅读更多 »Vpp私有API协议入门
1. 通信方式及IP类型 Anycast与Multicast,Unicast,Broadcast是四种不同的IP通信方式。按照通信方式,也可以将我们熟知的IP地址类型分为如下几种:Unicast IP,Multicast IP,Broadcast IP与Anycast IP。 1.1. Unicast IP 在客户端与媒体服务器… 阅读更多 »Anycast概述
文中三种协议类型,都通过建立veth pair打通Linux和VPP环境。 1. VLAN 1.1. 创建Linux veth pair对进行配置
1 2 3 4 5 |
# 创建Linux veth pair对进行配置 ip link add ki type veth peer name vi # vpp 接管 host interface 接口 vppctl create host-interface name vi vppctl set int state host-vi up |
1.2. linux kernel创建vlan vlan基本介绍 linux网卡的vlan配置 [crayon-65… 阅读更多 »VLAN_GRE_VXLAN三种协议在Linux+Vpp环境的互通
无法提供摘要。这是一篇受保护的文章。
1. Quagga软件的安装与启动 lede如何安装quagga
1 2 3 4 5 |
opkg update opkg install quagga opkg install quagga-zebra quagga-ripd quagga-watchquagga quagga-vtysh quagga-bgpd quagga-ospfd /etc/init.d/quagga start #这是启动 /etc/init.d/quagga enable #自启动 |
centos如何安装quagga
1 2 |
yum update yum install quagga -y |
加载BPG配置文件 启动软件,Zebra和BGPd一起工作,zebra负责… 阅读更多 »Quagga如何配置BGP(转载)
1. 进程启动 先准备ovs的工作目录,数据库存储路径等
1 2 |
mkdir -p /etc/openvswitch mkdir -p /var/run/openvswitch |
先启动ovsdb-server
1 2 3 4 5 6 7 8 9 |
ovsdb-server /etc/openvswitch/conf.db \ -vconsole:emer -vsyslog:err -vfile:info \ --remote=punix:/var/run/openvswitch/db.sock \ --private-key=db:Open_vSwitch,SSL,private_key \ --certificate=db:Open_vSwitch,SSL,certificate \ --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir \ --log-file=/var/log/openvswitch/ovsdb-server.log \ --pidfile=/var/run/openvswitch/ovsdb-server.pid \ --detach --monitor |
ps: 如果想清除配置,可以先删除/etc/openvswitch/*,然后再手动创建一个数据库: [cra… 阅读更多 »OVS常用命令与使用总结(转载)