mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
config: catch up with the latest openconfig
using commit 20b9cc544012201069e9d6a159ebab17f4172dfb from github.com/openconfig/public Signed-off-by: ISHIDA Wataru <[email protected]>
This commit is contained in:
committed by
FUJITA Tomonori
parent
b0fbcc6b1b
commit
a0b87f1ddf
+10
-4
@@ -17,6 +17,12 @@ package config
|
||||
|
||||
import "fmt"
|
||||
|
||||
// typedef for typedef openconfig-types:std-regexp
|
||||
type StdRegexp string
|
||||
|
||||
// typedef for typedef openconfig-types:percentage
|
||||
type Percentage uint8
|
||||
|
||||
// typedef for typedef bgp-types:rr-cluster-id-type
|
||||
type RrClusterIdType string
|
||||
|
||||
@@ -45,7 +51,7 @@ func (v RemovePrivateAsOption) Validate() error {
|
||||
}
|
||||
|
||||
// typedef for typedef bgp-types:bgp-community-regexp-type
|
||||
type BgpCommunityRegexpType string
|
||||
type BgpCommunityRegexpType StdRegexp
|
||||
|
||||
// typedef for typedef bgp-types:community-type
|
||||
type CommunityType string
|
||||
@@ -103,9 +109,6 @@ func (v PeerTypeDef) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// typedef for typedef bgp-types:percentage
|
||||
type Percentage uint8
|
||||
|
||||
// typedef for typedef bgp-types:bgp-session-direction
|
||||
type BgpSessionDirection string
|
||||
|
||||
@@ -1742,6 +1745,9 @@ type BgpConditions struct {
|
||||
// original -> bgp-pol:next-hop-in
|
||||
//original type is list of inet:ip-address
|
||||
NextHopIn []string
|
||||
// original -> bgp-pol:afi-safi-in
|
||||
//original type is list of identityref
|
||||
AfiSafiIn []string
|
||||
// original -> bgp-pol:local-pref-eq
|
||||
LocalPrefEq uint32
|
||||
// original -> bgp-pol:community-count
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
What's this ?
|
||||
=============
|
||||
This is a pyang plugin to generate config/bgp_configs.go from
|
||||
openconfig yang files.
|
||||
|
||||
Currently, we made some modifications to the yang files:
|
||||
|
||||
https://github.com/osrg/yang/tree/gobgp
|
||||
|
||||
openconfig yang files (see [https://github.com/openconfig/public](https://github.com/openconfig/public))
|
||||
|
||||
How to use
|
||||
==========
|
||||
::
|
||||
|
||||
$ git clone -b gobgp https://github.com/osrg/yang
|
||||
$ YANG_DIR=`pwd`/yang
|
||||
$ git clone https://github.com/openconfig/public
|
||||
$ git clone https://github.com/YangModels/yang
|
||||
$ YANG_DIR=`pwd`
|
||||
$ cd $PYANG_INSTALL_DIR
|
||||
$ source ./env.sh
|
||||
$ PYTHONPATH=. ./bin/pyang --plugindir $GOBGP_PATH/tools/pyang_plugins \
|
||||
-p $YANG_DIR/standard/ietf/RFC \
|
||||
-p $YANG_DIR/experimental/openconfig/bgp \
|
||||
-p $YANG_DIR/experimental/openconfig/policy \
|
||||
-f golang $YANG_DIR/experimental/openconfig/bgp/bgp.yang \
|
||||
$YANG_DIR/bgp/bgp.yang $YANG_DIR/bgp/bgp-policy.yang \
|
||||
-p $YANG_DIR/yang/standard/ietf/RFC \
|
||||
-p $YANG_DIR/public/release/models \
|
||||
-p $YANG_DIR/public/release/models/bgp \
|
||||
-p $YANG_DIR/public/release/models/policy \
|
||||
-f golang $YANG_DIR/public/release/models/bgp/openconfig-bgp.yang \
|
||||
$YANG_DIR/public/release/modesl/policy/openconfig-routing-policy.yang \
|
||||
$GOBGP_PATH/tools/pyang_plugins/gobgp.yang \
|
||||
| gofmt > $GOBGP_PATH/config/bgp_configs.go
|
||||
|
||||
@@ -448,7 +448,14 @@ def emit_typedef(ctx, module):
|
||||
else:
|
||||
print >> o, '// typedef for typedef %s:%s'\
|
||||
% (prefix, type_name_org)
|
||||
print >> o, 'type %s %s' % (type_name, t.arg)
|
||||
|
||||
if not is_builtin_type(t):
|
||||
m = ctx.golang_typedef_map
|
||||
for k in t.arg.split(':'):
|
||||
m = m[k]
|
||||
print >> o, 'type %s %s' % (type_name, m.golang_name)
|
||||
else:
|
||||
print >> o, 'type %s %s' % (type_name, t.arg)
|
||||
|
||||
print o.getvalue()
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ module gobgp {
|
||||
prefix "gobgp";
|
||||
|
||||
// import some basic types
|
||||
import bgp { prefix bgp; }
|
||||
import routing-policy {prefix rpol; }
|
||||
import policy-types {prefix ptypes; }
|
||||
import bgp-policy {prefix bgp-pol; }
|
||||
import openconfig-bgp { prefix bgp; }
|
||||
import openconfig-routing-policy {prefix rpol; }
|
||||
import openconfig-policy-types {prefix ptypes; }
|
||||
import openconfig-bgp-policy {prefix bgp-pol; }
|
||||
import ietf-inet-types { prefix inet; }
|
||||
import ietf-yang-types { prefix yang; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user