Skip to content

Commit

Permalink
DANOS Import
Browse files Browse the repository at this point in the history
  • Loading branch information
deastoe committed Nov 11, 2019
0 parents commit b6376d4
Show file tree
Hide file tree
Showing 71 changed files with 10,221 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*~
*.orig
*#
.*.swp
debian/files
debian/tmp
debian/vyatta-frr-vci
debian/vyatta-protocols-frr
debian/*.debhelper.log
debian/*.substvars
debian/*-yang
120 changes: 120 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# vyatta-protocols-frr
67 changes: 67 additions & 0 deletions cmd/frr/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2018-2019, AT&T Intellectual Property.
// All rights reserved.
//
// SPDX-License-Identifier: GPL-2.0-only

package main

import (
"encoding/json"
"eng.vyatta.net/protocols"
"eng.vyatta.net/protocols/static"
"errors"
log "github.com/Sirupsen/logrus"
"os/exec"
)

const (
cfgFileName = "frr.json"
componentName = "net.vyatta.vci.frr"
v1Component = componentName + ".v1"
)

func Set(pmc *protocols.ProtocolsModelComponent, cfg []byte) error {
var frontend_interface, old_frontend_interface interface{}

old_cfg := pmc.Get()
old_conv_cfg, err := protocols.ConvertConfigToInternalJson(old_cfg)
if err != nil {
log.Errorln("Failed to convert old config from RFC 7951 JSON: " + err.Error())
return err
}
json.Unmarshal(old_conv_cfg, &old_frontend_interface)
old_frontend_map := old_frontend_interface.(map[string]interface{})

json.Unmarshal(cfg, &frontend_interface)
frontend_map := frontend_interface.(map[string]interface{})

//Strip out disabled nexthops and other translations
static.Translate(frontend_map, old_frontend_map)

//Enable MPLS in kernel if required
Mpls(frontend_map)

//Write new config file
jsonString, _ := json.MarshalIndent(frontend_map, "", " ")
err = pmc.WriteJsonFile(jsonString, pmc.GetDaemonConfigFilePath())
if err != nil {
log.Errorln(err)
return err
}

err = exec.Command("/opt/vyatta/sbin/parser.py").Run()
if err != nil {
msg := "Failed to run FRR translation: " + err.Error()
log.Errorln(msg)
return errors.New(msg)
}

log.Infoln("FRR translation successful")
return nil
}

func main() {
pmc := protocols.NewProtocolsModelComponent(v1Component, cfgFileName)
pmc.SetSetFunction(Set)
pmc.Run(componentName)
}
98 changes: 98 additions & 0 deletions cmd/frr/mpls.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright (c) 2018-2019, AT&T Intellectual Property.
// All rights reserved.
//
// SPDX-License-Identifier: GPL-2.0-only

package main

import (
"errors"
"fmt"
"os"
)

func Mpls(frontend_map map[string]interface{}) error {
if frontend_map == nil || frontend_map["protocols"] == nil {
return nil
}

proto_map := frontend_map["protocols"].(map[string]interface{})
if proto_map == nil || proto_map["mpls-ldp"] == nil {
return nil
}

ldp_map := proto_map["mpls-ldp"].(map[string]interface{})
if ldp_map == nil || ldp_map["address-family"] == nil {
return nil
}

af_map := ldp_map["address-family"].(map[string]interface{})
if af_map == nil || af_map["ipv4"] == nil {
return nil
}

v4_map := af_map["ipv4"].(map[string]interface{})
if v4_map == nil || v4_map["discovery"] == nil {
return nil
}

disc_map := v4_map["discovery"].(map[string]interface{})
if disc_map == nil || disc_map["interfaces"] == nil {
return nil
}

intf_map := disc_map["interfaces"].(map[string]interface{})
if intf_map == nil || intf_map["interface"] == nil {
return nil
}

intf_arr := intf_map["interface"].([]interface{})
if intf_arr == nil {
return nil
}

//Set up kernel label table
f, err := os.OpenFile("/proc/sys/net/mpls/platform_labels",
os.O_WRONLY, 0)
if err != nil {
msg := "Failed to open platform labels: " + err.Error()
fmt.Println(msg)
return errors.New(msg)
}
_, err = f.Write([]byte("1048575\n"))
f.Close()
if err != nil {
msg := "Failed to write platform labels: " + err.Error()
fmt.Println(msg)
return errors.New(msg)
}

for _, intf_entry := range intf_arr {
intf_entry_map := intf_entry.(map[string]interface{})
if intf_entry_map["interface"] == nil {
continue
}

intf_name := intf_entry_map["interface"].(string)

//Enable MPLS forwarding on the interface
f, err = os.OpenFile("/proc/sys/net/mpls/conf/"+intf_name+
"/input", os.O_WRONLY, 0)
if err != nil {
msg := "Failed to open MPLS conf for " +
intf_name + ": " + err.Error()
fmt.Println(msg)
return errors.New(msg)
}
_, err = f.Write([]byte("1\n"))
f.Close()
if err != nil {
msg := "Failed to write MPLS conf for " +
intf_name + ": " + err.Error()
fmt.Println(msg)
return errors.New(msg)
}
}

return nil
}
1 change: 1 addition & 0 deletions component-config/frr.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!
2 changes: 2 additions & 0 deletions component-config/mpls-modules.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mpls_router
mpls_iptunnel
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vyatta-protocols-frr (1.12.3) unstable; urgency=medium

* DANOS Import

-- Vyatta Package Maintainers <[email protected]> Mon, 4 Nov 2019 14:30:00 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
188 changes: 188 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
Source: vyatta-protocols-frr
Section: contrib/net
Priority: extra
Maintainer: Vyatta Package Maintainers <[email protected]>
Build-Depends:
debhelper (>= 9),
dh-golang,
dh-python,
dh-vci,
dh-yang,
golang-any,
golang-vyatta-protocols-dev,
python3
Standards-Version: 3.9.8

Package: vyatta-protocols-frr
Provides: vyatta-protocols
Conflicts: vyatta-protocols-ipi
Breaks: vyatta-protocols (<< 1.12.0)
Replaces: vyatta-protocols (<< 1.12.0)
Architecture: all
Depends: frr, vyatta-protocols-common, ${misc:Depends}
Description: Common scripts & libs for FRR on Vyatta

Package: vyatta-op-show-ip-ipv6-route-frr-v1-yang
Architecture: all
Depends: ${misc:Depends}, ${yang:Depends}
Description: Routing table show CLI for FRR
The YANG module package for vyatta-op-show-ip-ipv6-route-frr-v1

Package: vyatta-op-show-monitoring-protocols-frr-v1-yang
Architecture: all
Depends: ${misc:Depends}, ${yang:Depends}
Description: "show monitoring protocols" operational YANG module
The YANG module package for vyatta-op-show-monitoring-protocols-frr-yang

Package: vyatta-op-protocols-frr-zebra-v1-yang
Architecture: all
Depends: ${misc:Depends}, ${yang:Depends}
Description: Zebra operational YANG module
The YANG module package for vyatta-op-protocols-frr-zebra-v1-yang

Package: vyatta-op-protocols-frr-bgp-v1-yang
Architecture: all
Depends:
vyatta-op-common-protocols-bgp-v1-yang,
${misc:Depends},
${yang:Depends}
Description: BGP operational YANG module
The YANG module package for vyatta-op-frr-bgp-v1-yang

Package: vyatta-op-protocols-frr-bgp-routing-instance-v1-yang
Architecture: all
Depends:
vyatta-op-common-protocols-bgp-routing-instance-v1-yang,
${misc:Depends},
${yang:Depends}
Description: BGP routing instance operational YANG module
The YANG module package for vyatta-op-frr-bgp-routing-instance-v1-yang

Package: vyatta-protocols-frr-bgp-v1-yang
Architecture: all
Depends:
frr,
vyatta-cfg (>= 0.18.56),
vyatta-frr-vci,
vyatta-protocols-frr (>= ${source:Version}),
vyatta-vrrp-v1-yang,
${misc:Depends},
${perl:Depends},
${yang:Depends}
Description: bgp yang module package
The YANG module package for vyatta-protocols-bgp-v1

Package: vyatta-protocols-frr-bgp-routing-instance-v1-yang
Architecture: all
Depends: frr, vyatta-frr-vci, ${misc:Depends}, ${yang:Depends}
Description: BGP Yang module which supports Routing Instance
The YANG module for vyatta-protocols-frr-bgp-routing-instance-v1

Package: vyatta-frr-vci
Architecture: any
Priority: extra
Depends: frr-pythontools, python3, ${misc:Depends}, ${shlibs:Depends}
Conflicts:
vyatta-bgp-vci,
vyatta-ospf-vci,
vyatta-policy-route-vci,
vyatta-rib-vci
Built-Using: ${misc:Built-Using}
Description: FRR Service
Service for FRR using the Vyatta Component Infrastructure

Package: vyatta-op-protocols-frr-ospf-v1-yang
Architecture: all
Depends:
vyatta-op-common-protocols-ospf-v1-yang,
${misc:Depends},
${yang:Depends}
Description: OSPF operational YANG module
The YANG module package for vyatta-op-protocols-frr-ospf-v1-yang

Package: vyatta-op-protocols-frr-ospf-routing-instance-v1-yang
Architecture: all
Depends:
vyatta-op-common-protocols-ospf-routing-instance-v1-yang,
${misc:Depends},
${yang:Depends}
Description: OSPF routing instance operational YANG module
The YANG module package for vyatta-op-protocols-frr-ospf-routing-instance-v1-yang

Package: vyatta-protocols-frr-ospf-v1-yang
Architecture: all
Depends:
frr,
vyatta-cfg (>= 0.18.56),
vyatta-frr-vci,
vyatta-protocols-frr (>= ${source:Version}),
${misc:Depends},
${yang:Depends}
Conflicts: vyatta-protocols-ospf-v1-yang
Description: FRR ospf yang module package
The YANG module package for vyatta-protocols-frr-ospf-v1

Package: vyatta-protocols-frr-ospf-routing-instance-v1-yang
Architecture: all
Depends:
frr,
vyatta-cfg (>= 0.18.56),
vyatta-frr-vci,
vyatta-protocols-frr (>= ${source:Version}),
${misc:Depends},
${yang:Depends}
Description: ospf yang module package for routing-instance support
The YANG module package for vyatta-protocols-frr-ospf-routing-instance-v1

Package: vyatta-protocols-frr-switch-vif-ospf-v1-yang
Architecture: any
Depends: ${misc:Depends}, ${yang:Depends}
Description: switch VLAN ospf yang module package
The YANG module for enabling ospf on switch VLAN interfaces

Package: vyatta-op-protocols-frr-ospfv3-v1-yang
Architecture: all
Depends:
vyatta-op-common-protocols-ospfv3-v1-yang,
${misc:Depends},
${yang:Depends}
Description: OSPFv3 operational YANG module
The YANG module package for vyatta-op-protocols-frr-ospfv3-v1-yang

Package: vyatta-protocols-frr-ospfv3-v1-yang
Architecture: all
Depends:
frr,
vyatta-cfg (>= 0.18.56),
vyatta-frr-vci,
vyatta-protocols-frr (>= ${source:Version}),
${misc:Depends},
${yang:Depends}
Conflicts: vyatta-protocols-ospfv3-v1-yang
Description: FRR ospfv3 yang module package
The YANG module package for vyatta-protocols-frr-ospfv3-v1

Package: vyatta-protocols-frr-switch-vif-ospfv3-v1-yang
Architecture: any
Depends: ${misc:Depends}, ${yang:Depends}
Description: switch VLAN ospfv3 yang module package
The YANG module for enabling ospfv3 on switch VLAN interfaces

Package: vyatta-op-protocols-frr-ldp-v1-yang
Architecture: all
Depends: ${misc:Depends}, ${yang:Depends}
Description: LDP operational YANG module
The YANG module package for vyatta-op-frr-ldp-v1-yang

Package: vyatta-protocols-frr-ldp-v1-yang
Architecture: all
Depends:
frr,
vyatta-cfg (>= 0.18.56),
vyatta-frr-vci,
vyatta-protocols-frr (>= ${source:Version}),
${misc:Depends},
${yang:Depends}
Conflicts: vyatta-protocols-mpls-ldp-v1-yang
Description: FRR ldp yang module package
The YANG module package for vyatta-protocols-frr-ldp-v1
Loading

0 comments on commit b6376d4

Please sign in to comment.