├── .clang-format ├── .gitignore ├── .travis.yml ├── AFI ├── Makefile ├── README.md ├── afi-cap-action.yang ├── afi-cap-entry-action.yang ├── afi-cap-entry-match.yang ├── afi-cap-entry.yang ├── afi-cap-match.yang ├── afi-cap.yang ├── afi-common.yang ├── afi-cos-classifier.yang ├── afi-counter.yang ├── afi-decap.yang ├── afi-discard.yang ├── afi-encap-entry.yang ├── afi-encap.yang ├── afi-filter.yang ├── afi-fwd-sandbox.yang ├── afi-indexed-list.yang ├── afi-indirect.yang ├── afi-list.yang ├── afi-match.yang ├── afi-oam.yang ├── afi-policer.yang ├── afi-port.yang ├── afi-receive.yang ├── afi-replicate.yang ├── afi-sample.yang ├── afi-sandbox.yang ├── afi-selector.yang ├── afi-switch.yang ├── afi-table.yang ├── afi-tree-encap-entry.yang ├── afi-tree-encap.yang ├── afi-tree-entry.yang ├── afi-tree.yang ├── afi-types.yang ├── afi.yang ├── protos │ ├── juniper │ │ ├── afi_cap │ │ │ └── afi_cap.proto │ │ ├── afi_cap_action │ │ │ └── afi_cap_action.proto │ │ ├── afi_cap_entry │ │ │ └── afi_cap_entry.proto │ │ ├── afi_cap_entry_action │ │ │ └── afi_cap_entry_action.proto │ │ ├── afi_cap_entry_match │ │ │ └── afi_cap_entry_match.proto │ │ ├── afi_cap_match │ │ │ └── afi_cap_match.proto │ │ ├── afi_cos_classifier │ │ │ └── afi_cos_classifier.proto │ │ ├── afi_counter │ │ │ └── afi_counter.proto │ │ ├── afi_decap │ │ │ └── afi_decap.proto │ │ ├── afi_discard │ │ │ └── afi_discard.proto │ │ ├── afi_encap │ │ │ └── afi_encap.proto │ │ ├── afi_encap_entry │ │ │ └── afi_encap_entry.proto │ │ ├── afi_filter │ │ │ └── afi_filter.proto │ │ ├── afi_fwd_sandbox │ │ │ └── afi_fwd_sandbox.proto │ │ ├── afi_indexed_list │ │ │ └── afi_indexed_list.proto │ │ ├── afi_indirect │ │ │ └── afi_indirect.proto │ │ ├── afi_list │ │ │ └── afi_list.proto │ │ ├── afi_match │ │ │ └── afi_match.proto │ │ ├── afi_oam │ │ │ └── afi_oam.proto │ │ ├── afi_policer │ │ │ └── afi_policer.proto │ │ ├── afi_port │ │ │ └── afi_port.proto │ │ ├── afi_receive │ │ │ └── afi_receive.proto │ │ ├── afi_replicate │ │ │ └── afi_replicate.proto │ │ ├── afi_sample │ │ │ └── afi_sample.proto │ │ ├── afi_sandbox │ │ │ └── afi_sandbox.proto │ │ ├── afi_selector │ │ │ └── afi_selector.proto │ │ ├── afi_switch │ │ │ └── afi_switch.proto │ │ ├── afi_table │ │ │ └── afi_table.proto │ │ ├── afi_tree │ │ │ └── afi_tree.proto │ │ ├── afi_tree_encap │ │ │ └── afi_tree_encap.proto │ │ ├── afi_tree_encap_entry │ │ │ └── afi_tree_encap_entry.proto │ │ ├── afi_tree_entry │ │ │ └── afi_tree_entry.proto │ │ └── enums │ │ │ └── enums.proto │ ├── yext │ │ └── yext.proto │ └── ywrapper │ │ └── ywrapper.proto └── test │ └── afi-controller │ ├── .depend │ ├── Makefile │ ├── afi-controller │ ├── afi_switch.json │ ├── base64.cpp │ ├── base64.h │ └── main.cpp ├── EULA.docx ├── LICENSE ├── Makefile ├── README.md ├── build ├── make-all-aft.sh ├── make-all-brcm.sh ├── make-all-null-wrl.sh └── make-all-null.sh ├── cli ├── build.sh ├── cli.py ├── jp4cli_pb2.py └── jp4cli_pb2_grpc.py ├── config ├── afi-switch-cfg.json ├── aft-target-halp-cfg.json ├── jp4agent-brcm-cfg.json └── jp4agent-cfg.json ├── docs ├── CodingGuidelines.md ├── Jaeger.md ├── README.md ├── WorkingWithVMX.md ├── p4 │ └── README.md └── resources │ ├── External-tester.png │ ├── JP4Agent.png │ ├── JP4Agent_layers.png │ ├── JaegerIntegration.png │ ├── README.md │ ├── afi-yang-compilation.png │ ├── docker-setup.png │ ├── jaeger-vector.svg │ ├── jp4agent_python_cli.png │ └── vmx_with_tester.png ├── src ├── .gitignore ├── README.md ├── afi │ ├── include │ │ ├── Afi.h │ │ ├── AfiCap.h │ │ ├── AfiCapAction.h │ │ ├── AfiCapEntry.h │ │ ├── AfiCapEntryAction.h │ │ ├── AfiCapEntryMatch.h │ │ ├── AfiCapMatch.h │ │ ├── AfiCreator.h │ │ ├── AfiDM.h │ │ ├── AfiDevice.h │ │ ├── AfiEncap.h │ │ ├── AfiEncapEntry.h │ │ ├── AfiJsonResource.h │ │ ├── AfiNext.h │ │ ├── AfiObject.h │ │ ├── AfiTree.h │ │ ├── AfiTreeEncap.h │ │ ├── AfiTreeEncapEntry.h │ │ ├── AfiTreeEntry.h │ │ └── AfiTypes.h │ └── src │ │ ├── Afi.cpp │ │ ├── AfiCap.cpp │ │ ├── AfiCapAction.cpp │ │ ├── AfiCapEntry.cpp │ │ ├── AfiCapEntryAction.cpp │ │ ├── AfiCapEntryMatch.cpp │ │ ├── AfiCapMatch.cpp │ │ ├── AfiDevice.cpp │ │ ├── AfiEncap.cpp │ │ ├── AfiEncapEntry.cpp │ │ ├── AfiJsonResource.cpp │ │ ├── AfiTree.cpp │ │ ├── AfiTreeEncap.cpp │ │ ├── AfiTreeEncapEntry.cpp │ │ ├── AfiTreeEntry.cpp │ │ └── Makefile ├── config.yaml ├── jp4agent │ ├── include │ │ └── JP4Agent.h │ └── src │ │ ├── JP4Agent.cpp │ │ └── Makefile ├── pi │ ├── include │ │ ├── CLIService.h │ │ ├── ControllerConnection.h │ │ ├── DeviceHPPacket.h │ │ ├── Hostpath.h │ │ ├── P4Info.h │ │ ├── P4RuntimeService.h │ │ ├── PI.h │ │ ├── PIServer.h │ │ └── pvtPI.h │ ├── protos │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── cli │ │ │ └── jp4cli.proto │ │ ├── google │ │ │ └── rpc │ │ │ │ ├── code.proto │ │ │ │ ├── error_details.proto │ │ │ │ └── status.proto │ │ ├── p4 │ │ │ ├── config │ │ │ │ └── p4info.proto │ │ │ └── tmp │ │ │ │ └── p4config.proto │ │ ├── p4info.proto │ │ ├── p4runtime.proto │ │ ├── p4runtime_wrl.proto │ │ └── status.proto │ └── src │ │ ├── CLIService.cpp │ │ ├── ControllerConnection.cpp │ │ ├── DeviceHPPacket.cpp │ │ ├── Hostpath.cpp │ │ ├── Makefile │ │ ├── P4Info.cpp │ │ ├── P4RuntimeService.cpp │ │ ├── PI.cpp │ │ └── PIServer.cpp ├── targets │ ├── aft │ │ ├── aft │ │ │ ├── README.md │ │ │ ├── include │ │ │ │ ├── Aft.h │ │ │ │ ├── AftClient.h │ │ │ │ ├── AftDevice.h │ │ │ │ ├── AftObject.h │ │ │ │ ├── AftTree.h │ │ │ │ └── AftTreeEntry.h │ │ │ └── src │ │ │ │ ├── Aft.cpp │ │ │ │ ├── AftClient.cpp │ │ │ │ ├── AftDevice.cpp │ │ │ │ ├── AftObject.cpp │ │ │ │ ├── AftTree.cpp │ │ │ │ ├── AftTreeEntry.cpp │ │ │ │ └── Makefile │ │ ├── bin │ │ │ ├── .gitignore │ │ │ ├── gdb-jp4agent │ │ │ └── run-jp4agent │ │ ├── config │ │ │ └── aft-cfg.json │ │ └── src │ │ │ ├── Main.cpp │ │ │ └── Makefile │ ├── brcm │ │ ├── .gitkeep │ │ ├── bin │ │ │ ├── gdb-jp4agent │ │ │ └── run-jp4agent │ │ ├── brcm │ │ │ ├── README.md │ │ │ ├── include │ │ │ │ ├── Brcm.h │ │ │ │ ├── BrcmCap.h │ │ │ │ ├── BrcmCapEntry.h │ │ │ │ ├── BrcmDevice.h │ │ │ │ ├── BrcmObject.h │ │ │ │ ├── BrcmTree.h │ │ │ │ └── BrcmTreeEntry.h │ │ │ └── src │ │ │ │ ├── Brcm.cpp │ │ │ │ ├── BrcmCap.cpp │ │ │ │ ├── BrcmCapEntry.cpp │ │ │ │ ├── BrcmDevice.cpp │ │ │ │ ├── BrcmObject.cpp │ │ │ │ ├── BrcmTree.cpp │ │ │ │ ├── BrcmTreeEntry.cpp │ │ │ │ └── Makefile │ │ └── src │ │ │ ├── Main.cpp │ │ │ └── Makefile │ └── null │ │ ├── README.md │ │ ├── bin │ │ ├── .gitignore │ │ ├── gdb-jp4agent │ │ └── run-jp4agent │ │ ├── config │ │ └── null-target-cfg.json │ │ ├── null │ │ ├── README.md │ │ ├── include │ │ │ ├── Null.h │ │ │ ├── NullDevice.h │ │ │ ├── NullObject.h │ │ │ ├── NullTree.h │ │ │ └── NullTreeEntry.h │ │ └── src │ │ │ ├── Makefile │ │ │ ├── Null.cpp │ │ │ ├── NullDevice.cpp │ │ │ ├── NullObject.cpp │ │ │ ├── NullTree.cpp │ │ │ └── NullTreeEntry.cpp │ │ └── src │ │ ├── Main.cpp │ │ └── Makefile └── utils │ ├── include │ ├── JaegerLog.h │ ├── Log.h │ ├── Utils.h │ └── uint128.h │ └── src │ ├── JaegerLog.cpp │ ├── Makefile │ ├── Utils.cpp │ └── uint128.cpp ├── test ├── controller │ ├── .gitignore │ ├── README │ ├── bin │ │ ├── gdb-controller │ │ └── run-controller │ ├── include │ │ ├── Controller.h │ │ ├── P4InfoUtils.h │ │ └── Utils.h │ ├── src │ │ ├── Controller.cpp │ │ ├── Main.cpp │ │ ├── Makefile │ │ └── P4InfoUtils.cpp │ └── testdata │ │ ├── afi_switch.json │ │ ├── loopback.json │ │ ├── loopback.p4 │ │ ├── loopback.proto.txt │ │ ├── packet_io.json │ │ ├── packet_io.p4 │ │ ├── packet_io.proto.txt │ │ ├── simple_router.json │ │ ├── simple_router.proto.txt │ │ ├── spine.json │ │ └── spine.p4rt ├── gtest │ ├── .gitignore │ ├── README.md │ ├── bin │ │ ├── GTEST_EXPECTED │ │ │ └── P4 │ │ │ │ ├── hostPing │ │ │ │ └── ge-0.0.2-vmx1.pcap │ │ │ │ ├── injectL2Pkt │ │ │ │ └── ge-0.0.2-vmx1.pcap │ │ │ │ ├── ipv4Router │ │ │ │ ├── ge-0.0.2-vmx1.pcap │ │ │ │ └── ge-0.0.3-vmx1.pcap │ │ │ │ ├── puntL2Pkt │ │ │ │ └── ge-0.0.2-vmx1.pcap │ │ │ │ └── sendArpReq │ │ │ │ └── ge-0.0.2-vmx1.pcap │ │ └── run-jp4agent-gtest │ ├── include │ │ ├── TapIf.h │ │ ├── TestPacket.h │ │ └── TestUtils.h │ └── src │ │ ├── GTest.cpp │ │ ├── GTestBrcm.cpp │ │ ├── GTestBrcmSpine.cpp │ │ ├── Makefile │ │ ├── TapIf.cpp │ │ ├── TestPacket.cpp │ │ └── TestUtils.cpp └── scripts │ ├── nullTest.sh │ └── udp_server.py └── tools ├── .gitignore ├── README.md ├── config ├── cron.cfg ├── regression-cfg.xml └── vmx-cfg.xml ├── docker ├── Dockerfile_p4 ├── Dockerfile_p4_vmx ├── cfg │ ├── _vPFE-ref.xml │ ├── cron.cfg │ ├── fwd_sandbox_junos_config.txt │ ├── junos_config.txt │ ├── vmx-junosdev.conf │ └── vmx.conf ├── entrypoint.sh ├── env │ ├── bash_aliases │ ├── tmux.conf │ └── vimrc └── scripts │ ├── .gitignore │ ├── build-jp4.sh │ ├── check_vmx.exp │ ├── clear_rior_zt.log.sh │ ├── cmn.sh │ ├── config_br-int-vmx1.sh │ ├── config_fpc0.exp │ ├── config_fwd_sandbox.exp │ ├── config_junos.exp │ ├── config_tap_interfaces.sh │ ├── config_vfp_ext_if.exp │ ├── config_vmx_links.sh │ ├── cp_aft_pkg_to_vcp.exp │ ├── disable_flow_cache.exp │ ├── dump_debug_info.exp │ ├── generate_coverage_report.sh │ ├── lib.exp │ ├── restart_fpc0.exp │ ├── setup_vmx.sh │ ├── shutdown_jp4agent.sh │ └── stop_vmx.sh ├── report ├── .gitignore ├── gtest-not-run.xml ├── gtest-result.dtd ├── gtest-result.xsl ├── index.html └── regression.xsl └── scripts ├── bridge_cleanup.sh ├── build_push_docker.sh ├── clang-format.sh ├── cmn.sh ├── cpplint.py ├── cpplint.sh ├── delete_old_reports.sh ├── docker_run_gtests.exp ├── docker_setup_vmx.exp ├── generate_final_report.sh ├── http_server.py ├── install_packages.sh ├── lib.exp ├── package-vmx.sh ├── regression.sh ├── run-regression ├── schedule_cron_job.sh ├── setup-vmx └── start-http-server /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.so.* 4 | *.so 5 | *.o 6 | *.a 7 | obj 8 | 9 | # cscope/tags # 10 | ############### 11 | cscope.* 12 | tags 13 | 14 | # grpc/protobuf generated files # 15 | ################################# 16 | *.pb.cc 17 | *.pb.h 18 | 19 | # More files to ignore # 20 | ######################## 21 | *.swp 22 | *.pyc 23 | *.bak 24 | .depend 25 | AFI/protos/juniper 26 | CPPLINT.cfg 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Travis YAML file 2 | # 3 | # 4 | # Created by Manmeet Singh, February 2018 5 | # Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | # 7 | # All rights reserved. 8 | # 9 | # Notice and Disclaimer: This code is licensed to you under the Apache 10 | # License 2.0 (the "License"). You may not use this code except in compliance 11 | # with the License. This code is not an official Juniper product. You can 12 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Third-Party Code: This code may depend on other components under separate 15 | # copyright notice and license terms. Your use of the source code for those 16 | # components is subject to the terms and conditions of the respective license 17 | # as noted in the Third-Party source code file. 18 | 19 | language: cpp 20 | sudo: required 21 | dist: xenial 22 | services: 23 | - docker 24 | compiler: 25 | - gcc 26 | os: 27 | - linux 28 | before_install: 29 | - cd tools/docker; docker build -f Dockerfile_p4 -t juniper-p4 . 30 | - cd ../.. 31 | - docker run -d --name travis-p4 -v `pwd`:/root/JP4Agent --privileged -i -t juniper-p4 /bin/bash 32 | - docker ps -a 33 | script: 34 | - docker exec travis-p4 /bin/bash -c "cd /root/JP4Agent/build; ./make-all-null.sh" 35 | - docker exec travis-p4 /bin/bash -c "cd /root/JP4Agent/test/scripts; ./nullTest.sh" 36 | branches: 37 | only: 38 | - master 39 | -------------------------------------------------------------------------------- /AFI/README.md: -------------------------------------------------------------------------------- 1 | # AFI yang data model 2 | 3 | 4 | ### Compilation 5 | ``` 6 | make 7 | ``` 8 |
9 |
10 |
11 | 12 | -------------------------------------------------------------------------------- /AFI/afi-cap-entry.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Cap Entry 3 | // 4 | // Created by Sudheendra Gopinath, June 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-cap-entry { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-cap-entry/junos/17.3"; 14 | prefix "afi-cap-entry"; 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sudheendra Gopinath 21 | sgopinath@juniper.net"; 22 | 23 | description 24 | "This module provides data model for AFI Content Aware Processor Entry"; 25 | 26 | revision 2018-06-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | container afi-cap-entry { 31 | leaf parent-name { 32 | type string; 33 | description "Parent name"; 34 | } 35 | 36 | leaf match-object { 37 | type string; 38 | description "Match set"; 39 | } 40 | 41 | leaf action-object { 42 | type string; 43 | description "Action set"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AFI/afi-cap.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Content Aware Processor 3 | // 4 | // Created by Sudheendra Gopinath, June 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-cap { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-cap/junos/17.3"; 14 | prefix "afi-cap"; 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sudheendra Gopinath 21 | sgopinath@juniper.net"; 22 | 23 | description 24 | "This module provides data model for AFI Content Aware Processor"; 25 | 26 | revision 2019-06-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | container afi-cap { 31 | leaf cap-type { 32 | type enumeration { 33 | enum "VLAN"; 34 | enum "INGRESS"; 35 | enum "EGRESS"; 36 | enum "MY-MAC"; 37 | } 38 | description "Content Aware Processor Type"; 39 | } 40 | 41 | leaf group-id { 42 | type uint8; 43 | description "Group ID"; 44 | } 45 | 46 | leaf group-priority { 47 | type uint8; 48 | description "Group Priority"; 49 | } 50 | 51 | leaf match-object { 52 | type string; 53 | description "Match set"; 54 | } 55 | 56 | leaf action-object { 57 | type string; 58 | description "Action set"; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /AFI/afi-common.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Juniper Networks, Inc. 3 | // All rights reserved. 4 | // 5 | 6 | module afi-common { 7 | 8 | yang-version "1"; 9 | 10 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-cmn/junos/17.3"; 11 | prefix "afi-cmn"; 12 | 13 | organization 14 | "Juniper Networks, Inc."; 15 | 16 | contact 17 | "Sandesh Kumar Sodhi 18 | sksodhi@juniper.net"; 19 | 20 | description 21 | "This module provides data model for Juniper's Advanced Forwarding Interface"; 22 | 23 | revision 2017-12-02 { 24 | description "Initial revision."; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /AFI/afi-cos-classifier.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : COS Classifier 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-cos-classifier { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-cos-classifier/junos/17.3"; 14 | prefix "afi-cos-classifier"; 15 | 16 | 17 | import afi-types { prefix "afi-types"; } 18 | import afi-common { prefix "afi-cmn"; } 19 | 20 | organization 21 | "Juniper Networks, Inc."; 22 | 23 | contact 24 | "Sandesh Kumar Sodhi 25 | sksodhi@juniper.net"; 26 | 27 | description 28 | "COS classifier"; 29 | 30 | revision 2017-12-02 { 31 | description "Initial revision."; 32 | } 33 | 34 | container cos-classifier { 35 | description "Class of Service Classifier"; 36 | 37 | leaf name { 38 | description "Name"; 39 | type string; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /AFI/afi-counter.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Counter 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-counter { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-counter/junos/17.3"; 14 | prefix "afi-counter"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI Counter"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-counter { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-decap.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Decap 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-decap { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-decap/junos/17.3"; 14 | prefix "afi-decap"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI Decap"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-decap { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-discard.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Discard 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-discard { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-discard/junos/17.3"; 14 | prefix "afi-discard"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "Disacard"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-discard { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-encap-entry.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Encap Entry 3 | // 4 | // Created by Sudheendra Gopinath, August 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-encap-entry { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-encap-entry/junos/17.3"; 14 | prefix "afi-encap-entry"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | 18 | organization 19 | "Juniper Networks, Inc."; 20 | 21 | contact 22 | "Sudheendra Gopinath 23 | sgopinath@juniper.net"; 24 | 25 | description 26 | "This module provides data model for AFI Encap Entry in Juniper's Advanced Forwarding Interface"; 27 | 28 | revision 2018-02-12 { 29 | description "Initial revision."; 30 | } 31 | 32 | container afi-encap-entry { 33 | description "AFT Encap Entry"; 34 | 35 | leaf name { 36 | description "Name"; 37 | type string; 38 | } 39 | 40 | leaf parent-name { 41 | description "Parent name"; 42 | type string; 43 | } 44 | 45 | list afi-key { 46 | key "field-name"; 47 | unique "field-name"; 48 | 49 | leaf field-name { 50 | description "Encap field name"; 51 | type afi-types:afi-field; 52 | } 53 | 54 | leaf field-data { 55 | description "Encap field data"; 56 | type binary; 57 | } 58 | } 59 | 60 | leaf-list dummy { 61 | type afi-types:afi-field; 62 | description "Dummy"; 63 | } 64 | 65 | leaf target-afi-object { 66 | description "Target afi object to execute on entry match"; 67 | type string; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /AFI/afi-encap.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Encap 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-encap { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-encap/junos/17.3"; 14 | prefix "afi-encap"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | 18 | organization 19 | "Juniper Networks, Inc."; 20 | 21 | contact 22 | "Sandesh Kumar Sodhi 23 | sksodhi@juniper.net"; 24 | 25 | description 26 | "Encap"; 27 | 28 | revision 2017-12-02 { 29 | description "Initial revision."; 30 | } 31 | 32 | container afi-encap { 33 | description "AFI Encap"; 34 | 35 | leaf name { 36 | description "Name"; 37 | type string; 38 | } 39 | 40 | leaf encap-name { 41 | type string; 42 | description "Encapsulation name"; 43 | } 44 | 45 | leaf-list key-fields { 46 | type afi-types:afi-field; 47 | description "List of fields"; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /AFI/afi-filter.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Filter 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-filter { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-filter/junos/17.3"; 14 | prefix "afi-filter"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "This module provides data model for AFI Filter"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-filter { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-fwd-sandbox.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Juniper Networks, Inc. 3 | // All rights reserved. 4 | // 5 | 6 | module afi-fwd-sandbox { 7 | 8 | yang-version "1"; 9 | 10 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-fwd-sandbox/junos/17.3"; 11 | prefix "afi-fwd-sb"; 12 | 13 | import afi-types { prefix "afi-types"; } 14 | import afi-common { prefix "afi-cmn"; } 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sandesh Kumar Sodhi 21 | sksodhi@juniper.net"; 22 | 23 | description 24 | "This module provides data model for Juniper's Advanced Forwarding Interface"; 25 | 26 | revision 2017-12-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | container fwd-sandbox { 31 | description "Forwarding sandbox"; 32 | 33 | leaf sandbox-name { 34 | description "Sandbox name"; 35 | type string; 36 | } 37 | 38 | list input-port { 39 | description "Forwarding sandbox input port"; 40 | key "port-index"; 41 | unique "port-name"; 42 | 43 | leaf port-index { 44 | description "Port index"; 45 | type uint32; 46 | } 47 | 48 | leaf port-name { 49 | description "Port name"; 50 | type string; 51 | } 52 | } 53 | 54 | list output-port { 55 | description "Forwarding sandbox ouput port"; 56 | key "port-index"; 57 | unique "port-name"; 58 | 59 | leaf port-index { 60 | description "Port index"; 61 | type uint32; 62 | } 63 | 64 | leaf port-name { 65 | description "Port name"; 66 | type string; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /AFI/afi-indexed-list.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Indexed list 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-indexed-list { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-indexed-list/junos/17.3"; 14 | prefix "afi-indexed-list"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI indexed list"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-indexed-list { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-indirect.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Indirect 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-indirect { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-indirect/junos/17.3"; 14 | prefix "afi-indirect"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "Indirect"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-indirect { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-list.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : List 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-list { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-list/junos/17.3"; 14 | prefix "afi-list"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI list"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-list { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-match.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Match 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-match { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-match/junos/17.3"; 14 | prefix "afi-match"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI match"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-match { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-oam.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : OAM 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-oam { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-oam/junos/17.3"; 14 | prefix "afi-oam"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI OAM"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-oam { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-policer.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Policer/Meter 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-policer { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-policer/junos/17.3"; 14 | prefix "afi-policer"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI policer/meter"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-policer { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-port.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Port 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-port { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-port/junos/17.3"; 14 | prefix "afi-port"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI port"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-port { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-receive.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Receive 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-receive { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-receive/junos/17.3"; 14 | prefix "afi-receive"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI receive"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-receive { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-replicate.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Replicate 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-replicate { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-replicate/junos/17.3"; 14 | prefix "afi-replicate"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI Replicate"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-replicate { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-sample.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Sample 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-sample { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-sample/junos/17.3"; 14 | prefix "afi-sample"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI Sample"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-sample { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-sandbox.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Sandbox 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-sandbox { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-sandbox/junos/17.3"; 14 | prefix "afi-sb"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "This module provides data model for Juniper's Advanced Forwarding Interface"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container sandbox { 34 | description "Sandbox"; 35 | 36 | leaf sandbox-name { 37 | description "Sandbox name"; 38 | type string; 39 | } 40 | 41 | list input-port { 42 | description "Sandbox input port"; 43 | key "port-index"; 44 | unique "port-name"; 45 | 46 | leaf port-index { 47 | description "Port index"; 48 | type uint32; 49 | } 50 | 51 | leaf port-name { 52 | description "Port name"; 53 | type string; 54 | } 55 | } 56 | 57 | list output-port { 58 | description "Sandbox ouput port"; 59 | key "port-index"; 60 | unique "port-name"; 61 | 62 | leaf port-index { 63 | description "Port index"; 64 | type uint32; 65 | } 66 | 67 | leaf port-name { 68 | description "Port name"; 69 | type string; 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /AFI/afi-selector.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Selector 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-selector { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-selector/junos/17.3"; 14 | prefix "afi-selector"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI Selector"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-selector { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-switch.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Switch 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-switch { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-switch/junos/17.3"; 14 | prefix "afi-switch"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "Static multi-part conditional"; 28 | 29 | revision 2018-01-31 { 30 | description "Initial revision."; 31 | } 32 | 33 | container switch-case { 34 | description "AFI switch case"; 35 | 36 | leaf name { 37 | type string; 38 | description "Name of switch case"; 39 | } 40 | 41 | leaf value { 42 | type string; 43 | description "Field to use for switch"; 44 | } 45 | 46 | leaf node { 47 | type string; 48 | description "Node to go to, on match"; 49 | } 50 | } 51 | 52 | container afi-switch { 53 | description "AFI switch"; 54 | 55 | leaf name { 56 | type string; 57 | description "Name of switch node"; 58 | } 59 | 60 | leaf switch-field { 61 | type afi-types:afi-field; 62 | description "Field to use for switch"; 63 | } 64 | 65 | leaf-list key-fields { 66 | type afi-types:afi-field; 67 | description "List of fields"; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /AFI/afi-table.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : Table 3 | // 4 | // Created by Sandesh Kumar Sodhi, January 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-table { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-table/junos/17.3"; 14 | prefix "afi-table"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | import afi-common { prefix "afi-cmn"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "AFI table"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-table { 34 | description "TBD"; 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AFI/afi-tree-encap-entry.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Tree EnCap Entry 3 | // 4 | // Created by Sudheendra Gopinath, June 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-tree-encap-entry { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-tree-encap-entry/junos/17.3"; 14 | prefix "afi-tree-encap-entry"; 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sudheendra Gopinath 21 | sgopinath@juniper.net"; 22 | 23 | description 24 | "This module provides data model for AFI Tree and Packet Encapsulation Entry"; 25 | 26 | revision 2018-06-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | container afi-tree-encap-entry { 31 | leaf parent-name { 32 | type string; 33 | description "Parent name"; 34 | } 35 | 36 | leaf tree-entry-object { 37 | type string; 38 | description "Tree entry object"; 39 | } 40 | 41 | leaf encap-entry-object { 42 | type string; 43 | description "Encap entry object"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AFI/afi-tree-encap.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Tree_And_Encapuslation 3 | // 4 | // Created by Sudheendra Gopinath, August 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-tree-encap { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-tree-encap/junos/17.3"; 14 | prefix "afi-tree-encap"; 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sudheendra Gopinath 21 | sgopinath@juniper.net"; 22 | 23 | description 24 | "This module provides data model for AFI Tree and Encapsulation"; 25 | 26 | revision 2019-06-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | container afi-tree-encap { 31 | leaf tree-object { 32 | type string; 33 | description "Tree object"; 34 | } 35 | 36 | leaf encap-object { 37 | type string; 38 | description "Encap object"; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /AFI/afi-tree-entry.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Tree Entry 3 | // 4 | // Created by Sandesh Kumar Sodhi, February 2018 5 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-tree-entry { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-tree-entry/junos/17.3"; 14 | prefix "afi-tree-entry"; 15 | 16 | import afi-types { prefix "afi-types"; } 17 | 18 | organization 19 | "Juniper Networks, Inc."; 20 | 21 | contact 22 | "Sandesh Kumar Sodhi 23 | sksodhi@juniper.net"; 24 | 25 | description 26 | "This module provides data model for AFI Tree Entry in Juniper's Advanced Forwarding Interface"; 27 | 28 | revision 2018-02-12 { 29 | description "Initial revision."; 30 | } 31 | 32 | container afi-tree-entry { 33 | description "AFT Tree Entry"; 34 | 35 | leaf name { 36 | description "Name"; 37 | type string; 38 | } 39 | 40 | leaf parent-name { 41 | description "Parent name"; 42 | type string; 43 | } 44 | 45 | leaf prefix-bytes { 46 | description "Prefix bytes"; 47 | type string; 48 | } 49 | 50 | leaf prefix-length { 51 | description "Prefix length"; 52 | type uint16; 53 | } 54 | 55 | leaf vrf-id { 56 | description "VRF ID"; 57 | type uint32; 58 | } 59 | 60 | leaf target-afi-object { 61 | description "Target afi object to execute this entry matches"; 62 | type string; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /AFI/afi-tree.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper AFI : AFI Tree 3 | // 4 | // Created by Sandesh Kumar Sodhi, December 2017 5 | // Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 6 | // 7 | // 8 | 9 | module afi-tree { 10 | 11 | yang-version "1"; 12 | 13 | namespace "http://yang.juniper.net/yang/1.1/jc/afi-tree/junos/17.3"; 14 | prefix "afi-tree"; 15 | 16 | 17 | import afi-types { prefix "afi-types"; } 18 | 19 | organization 20 | "Juniper Networks, Inc."; 21 | 22 | contact 23 | "Sandesh Kumar Sodhi 24 | sksodhi@juniper.net"; 25 | 26 | description 27 | "This module provides data model for AFI Tree in Juniper's Advanced Forwarding Interface"; 28 | 29 | revision 2017-12-02 { 30 | description "Initial revision."; 31 | } 32 | 33 | container afi-tree { 34 | description "AFT Tree"; 35 | 36 | leaf name { 37 | description "Name of tree"; 38 | type string; 39 | } 40 | 41 | leaf-list key-fields { 42 | type afi-types:afi-field; 43 | description "List of fields"; 44 | } 45 | 46 | // Below must be removed. 47 | leaf key-field { 48 | type string; 49 | description "Key field"; 50 | } 51 | 52 | leaf proto { 53 | description "Protocol"; 54 | type afi-types:afi-protocol-index; 55 | } 56 | 57 | leaf type { 58 | type afi-types:afi-tree-type; 59 | description "Tree type"; 60 | } 61 | 62 | leaf default-next-node { 63 | description "Default node to execute if no match made"; 64 | type string; 65 | } 66 | 67 | leaf size { 68 | description "Size"; 69 | type uint32; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /AFI/afi.yang: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Juniper Networks, Inc. 3 | // All rights reserved. 4 | // 5 | 6 | module afi { 7 | 8 | yang-version "1"; 9 | 10 | namespace "http://yang.juniper.net/yang/1.1/jc/afi/junos/17.3"; 11 | prefix "afi"; 12 | 13 | import afi-types { prefix "afi-types"; } 14 | import afi-common { prefix "afi-cmn"; } 15 | 16 | organization 17 | "Juniper Networks, Inc."; 18 | 19 | contact 20 | "Sandesh Kumar Sodhi 21 | sksodhi@juniper.net"; 22 | 23 | description 24 | "Data model for Advanced Forwarding Interface"; 25 | 26 | revision 2017-12-02 { 27 | description "Initial revision."; 28 | } 29 | 30 | typedef port-state { 31 | description "Port state"; 32 | type enumeration { 33 | enum DOWN { 34 | description 35 | "Port state DOWN"; 36 | } 37 | enum UP { 38 | description 39 | "Port state UP"; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_cap/afi_cap.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_cap is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_cap; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiCap { 48 | enum CapType { 49 | CAPTYPE_UNSET = 0; 50 | CAPTYPE_VLAN = 1 [(yext.yang_name) = "VLAN"]; 51 | CAPTYPE_INGRESS = 2 [(yext.yang_name) = "INGRESS"]; 52 | CAPTYPE_EGRESS = 3 [(yext.yang_name) = "EGRESS"]; 53 | CAPTYPE_MY_MAC = 4 [(yext.yang_name) = "MY-MAC"]; 54 | } 55 | ywrapper.StringValue action_object = 359987726; 56 | CapType cap_type = 305421565; 57 | ywrapper.UintValue group_id = 502911037; 58 | ywrapper.UintValue group_priority = 302957514; 59 | ywrapper.StringValue match_object = 89788449; 60 | } 61 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_cap_action/afi_cap_action.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_cap_action is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_cap_action; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiCapAction { 48 | ywrapper.BoolValue copy_to_cpu = 503826992; 49 | ywrapper.BoolValue copy_to_cpu_cancel = 530999003; 50 | ywrapper.BoolValue cpu_queue = 315246306; 51 | ywrapper.BoolValue cpu_queue_mask = 451340863; 52 | ywrapper.BoolValue destination_class_id = 39883017; 53 | ywrapper.BoolValue drop = 334671545; 54 | ywrapper.BoolValue drop_cancel = 232920976; 55 | ywrapper.BoolValue source_class_id = 13743256; 56 | ywrapper.BoolValue vrf = 33275360; 57 | } 58 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_cap_entry/afi_cap_entry.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_cap_entry is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_cap_entry; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiCapEntry { 48 | ywrapper.StringValue action_object = 27856950; 49 | ywrapper.StringValue match_object = 215134633; 50 | ywrapper.StringValue parent_name = 87410884; 51 | } 52 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_cap_entry_action/afi_cap_entry_action.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_cap_entry_action is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_cap_entry_action; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiCapEntryAction { 48 | ywrapper.BoolValue copy_to_cpu = 244904514; 49 | ywrapper.BoolValue copy_to_cpu_cancel = 533151157; 50 | ywrapper.UintValue cpu_queue = 319334888; 51 | ywrapper.UintValue destination_class_id = 163126875; 52 | ywrapper.BoolValue drop = 363439759; 53 | ywrapper.BoolValue drop_cancel = 390299182; 54 | ywrapper.UintValue source_class_id = 279532798; 55 | ywrapper.UintValue vrf = 72687718; 56 | } 57 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_cos_classifier/afi_cos_classifier.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_cos_classifier is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_cos_classifier; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message CosClassifier { 48 | ywrapper.StringValue name = 125369254; 49 | } 50 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_counter/afi_counter.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_counter is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_counter; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiCounter { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_decap/afi_decap.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_decap is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_decap; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiDecap { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_discard/afi_discard.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_discard is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_discard; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiDiscard { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_encap/afi_encap.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_encap is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_encap; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | import "juniper/enums/enums.proto"; 47 | 48 | message AfiEncap { 49 | ywrapper.StringValue encap_name = 393899969; 50 | repeated juniper.enums.AfiEncapAfiField key_fields = 103217797; 51 | ywrapper.StringValue name = 73308845; 52 | } 53 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_encap_entry/afi_encap_entry.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_encap_entry is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_encap_entry; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | import "juniper/enums/enums.proto"; 47 | 48 | message AfiEncapEntry { 49 | message AfiKey { 50 | ywrapper.BytesValue field_data = 53072422; 51 | } 52 | message AfiKeyKey { 53 | juniper.enums.AfiEncapEntryAfiField field_name = 1; 54 | AfiKey afi_key = 2; 55 | } 56 | repeated AfiKeyKey afi_key = 212250188; 57 | repeated juniper.enums.AfiEncapEntryAfiField dummy = 108175812; 58 | ywrapper.StringValue name = 145587281; 59 | ywrapper.StringValue parent_name = 155499100; 60 | ywrapper.StringValue target_afi_object = 406864802; 61 | } 62 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_filter/afi_filter.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_filter is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_filter; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiFilter { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_fwd_sandbox/afi_fwd_sandbox.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_fwd_sandbox is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_fwd_sandbox; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message FwdSandbox { 48 | message InputPort { 49 | ywrapper.StringValue port_name = 146084661; 50 | } 51 | message InputPortKey { 52 | uint64 port_index = 1; 53 | InputPort input_port = 2; 54 | } 55 | message OutputPort { 56 | ywrapper.StringValue port_name = 463812234; 57 | } 58 | message OutputPortKey { 59 | uint64 port_index = 1; 60 | OutputPort output_port = 2; 61 | } 62 | repeated InputPortKey input_port = 74510687; 63 | repeated OutputPortKey output_port = 90683676; 64 | ywrapper.StringValue sandbox_name = 66102704; 65 | } 66 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_indexed_list/afi_indexed_list.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_indexed_list is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_indexed_list; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiIndexedList { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_indirect/afi_indirect.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_indirect is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_indirect; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiIndirect { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_list/afi_list.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_list is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_list; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiList { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_match/afi_match.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_match is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_match; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiMatch { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_oam/afi_oam.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_oam is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_oam; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiOam { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_policer/afi_policer.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_policer is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_policer; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiPolicer { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_port/afi_port.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_port is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_port; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiPort { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_receive/afi_receive.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_receive is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_receive; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiReceive { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_replicate/afi_replicate.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_replicate is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_replicate; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiReplicate { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_sample/afi_sample.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_sample is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_sample; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiSample { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_sandbox/afi_sandbox.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_sandbox is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_sandbox; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message Sandbox { 48 | message InputPort { 49 | ywrapper.StringValue port_name = 2033717; 50 | } 51 | message InputPortKey { 52 | uint64 port_index = 1; 53 | InputPort input_port = 2; 54 | } 55 | message OutputPort { 56 | ywrapper.StringValue port_name = 393340298; 57 | } 58 | message OutputPortKey { 59 | uint64 port_index = 1; 60 | OutputPort output_port = 2; 61 | } 62 | repeated InputPortKey input_port = 168164959; 63 | repeated OutputPortKey output_port = 252391452; 64 | ywrapper.StringValue sandbox_name = 272956080; 65 | } 66 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_selector/afi_selector.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_selector is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_selector; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiSelector { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_switch/afi_switch.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_switch is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_switch; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | import "juniper/enums/enums.proto"; 47 | 48 | message AfiSwitch { 49 | repeated juniper.enums.AfiSwitchAfiField key_fields = 43023453; 50 | ywrapper.StringValue name = 531046261; 51 | juniper.enums.AfiSwitchAfiField switch_field = 185566099; 52 | } 53 | 54 | message SwitchCase { 55 | ywrapper.StringValue name = 375078443; 56 | ywrapper.StringValue node = 457392418; 57 | ywrapper.StringValue value = 278619649; 58 | } 59 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_table/afi_table.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_table is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_table; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiTable { 48 | } 49 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_tree/afi_tree.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_tree is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_tree; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | import "juniper/enums/enums.proto"; 47 | 48 | message AfiTree { 49 | ywrapper.StringValue default_next_node = 188585364; 50 | ywrapper.StringValue key_field = 32307618; 51 | repeated juniper.enums.AfiTreeAfiField key_fields = 168622709; 52 | ywrapper.StringValue name = 71110621; 53 | ywrapper.UintValue proto = 228442342; 54 | ywrapper.UintValue size = 287392455; 55 | juniper.enums.AfiTreeAfiTreeType type = 184483852; 56 | } 57 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_tree_encap/afi_tree_encap.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_tree_encap is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_tree_encap; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiTreeEncap { 48 | ywrapper.StringValue encap_object = 226157325; 49 | ywrapper.StringValue tree_object = 261395432; 50 | } 51 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_tree_encap_entry/afi_tree_encap_entry.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_tree_encap_entry is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_tree_encap_entry; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiTreeEncapEntry { 48 | ywrapper.StringValue encap_entry_object = 299512082; 49 | ywrapper.StringValue parent_name = 448450194; 50 | ywrapper.StringValue tree_entry_object = 174244527; 51 | } 52 | -------------------------------------------------------------------------------- /AFI/protos/juniper/afi_tree_entry/afi_tree_entry.proto: -------------------------------------------------------------------------------- 1 | // juniper.afi_tree_entry is generated by proto_generator as a protobuf 2 | // representation of a YANG schema. 3 | // 4 | // Input schema modules: 5 | // - afi-cap-action.yang 6 | // - afi-cap-entry-action.yang 7 | // - afi-cap-entry-match.yang 8 | // - afi-cap-entry.yang 9 | // - afi-cap-match.yang 10 | // - afi-cap.yang 11 | // - afi-common.yang 12 | // - afi-cos-classifier.yang 13 | // - afi-counter.yang 14 | // - afi-decap.yang 15 | // - afi-discard.yang 16 | // - afi-encap-entry.yang 17 | // - afi-encap.yang 18 | // - afi-filter.yang 19 | // - afi-fwd-sandbox.yang 20 | // - afi-indexed-list.yang 21 | // - afi-indirect.yang 22 | // - afi-list.yang 23 | // - afi-match.yang 24 | // - afi-oam.yang 25 | // - afi-policer.yang 26 | // - afi-port.yang 27 | // - afi-receive.yang 28 | // - afi-replicate.yang 29 | // - afi-sample.yang 30 | // - afi-sandbox.yang 31 | // - afi-selector.yang 32 | // - afi-switch.yang 33 | // - afi-table.yang 34 | // - afi-tree-encap-entry.yang 35 | // - afi-tree-encap.yang 36 | // - afi-tree-entry.yang 37 | // - afi-tree.yang 38 | // - afi-types.yang 39 | // - afi.yang 40 | syntax = "proto3"; 41 | 42 | package juniper.afi_tree_entry; 43 | 44 | import "ywrapper/ywrapper.proto"; 45 | import "yext/yext.proto"; 46 | 47 | message AfiTreeEntry { 48 | ywrapper.StringValue name = 298281935; 49 | ywrapper.StringValue parent_name = 84475654; 50 | ywrapper.StringValue prefix_bytes = 312714340; 51 | ywrapper.UintValue prefix_length = 35426751; 52 | ywrapper.StringValue target_afi_object = 227270412; 53 | ywrapper.UintValue vrf_id = 245987046; 54 | } 55 | -------------------------------------------------------------------------------- /AFI/protos/yext/yext.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // yext extends the Protobuf FieldOptions to add allow new options to be 16 | // set storing characteristics of the YANG schema from which a protobuf 17 | // is generated. 18 | syntax = "proto3"; 19 | 20 | import "google/protobuf/descriptor.proto"; 21 | 22 | package yext; 23 | 24 | extend google.protobuf.FieldOptions { 25 | // schemapath stores the schema path to the field within the YANG schema. 26 | // The path stored is absolute if the entity is at the root of the schema 27 | // tree. In the case that it is not (i.e., it is an entity that has a parent 28 | // which is not a module, the path supplied is the relative path to the 29 | // parent of the entity). The field number for this extension is reserved 30 | // in the global protobuf registry. 31 | string schemapath = 1040; 32 | } 33 | 34 | extend google.protobuf.EnumValueOptions { 35 | // yang_name stores the original YANG name of the enumerated value, for 36 | // serialisation to a string. The field number for this extension is 37 | // reserved in the global protobuf registry. 38 | string yang_name = 1040; 39 | } 40 | -------------------------------------------------------------------------------- /AFI/test/afi-controller/.depend: -------------------------------------------------------------------------------- 1 | base64.o: base64.cpp base64.h 2 | main.o: main.cpp ../yang/AFI/protos/juniper/afi_tree/afi_tree.pb.h \ 3 | ../yang/AFI/protos/ywrapper/ywrapper.pb.h \ 4 | ../yang/AFI/protos/yext/yext.pb.h base64.h 5 | afi_tree.pb.o: ../yang/AFI/protos/juniper/afi_tree/afi_tree.pb.cc \ 6 | ../yang/AFI/protos/juniper/afi_tree/afi_tree.pb.h \ 7 | ../yang/AFI/protos/ywrapper/ywrapper.pb.h \ 8 | ../yang/AFI/protos/yext/yext.pb.h 9 | yext.pb.o: ../yang/AFI/protos/yext/yext.pb.cc \ 10 | ../yang/AFI/protos/yext/yext.pb.h 11 | ywrapper.pb.o: ../yang/AFI/protos/ywrapper/ywrapper.pb.cc \ 12 | ../yang/AFI/protos/ywrapper/ywrapper.pb.h 13 | -------------------------------------------------------------------------------- /AFI/test/afi-controller/afi-controller: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/AFI/test/afi-controller/afi-controller -------------------------------------------------------------------------------- /AFI/test/afi-controller/afi_switch.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "afi-object" : "kpqfexIKEHBhY2tldC5pcDQuZGFkZHLq/aGPAgoKCGlwdjRfbHBtuqyoyAgCCAo=", 4 | "afi-object-id" : 101, 5 | "afi-object-name" : "ipv4_lpm", 6 | "afi-object-type" : "afi-tree" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /AFI/test/afi-controller/base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // base64 encoding and decoding with C++. 3 | // Version: 1.01.00 4 | // 5 | 6 | #ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 7 | #define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A 8 | 9 | #include 10 | 11 | std::string base64_encode(char const* , unsigned int len); 12 | //std::string base64_decode(std::string const& s); 13 | int base64_decode(std::string const& encoded_string, char *bytes, unsigned int len); 14 | 15 | #endif /* BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A */ 16 | -------------------------------------------------------------------------------- /EULA.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/EULA.docx -------------------------------------------------------------------------------- /cli/build.sh: -------------------------------------------------------------------------------- 1 | #/bin/bash 2 | protoc -I. --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./jp4cli.proto 3 | protoc -I. --cpp_out=. ./jp4cli.proto 4 | python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./jp4cli.proto 5 | 6 | g++ -std=c++14 `pkg-config --cflags protobuf grpc` -c -o jp4cli.pb.o jp4cli.pb.cc 7 | g++ -std=c++14 `pkg-config --cflags protobuf grpc` -c -o jp4cli.grpc.pb.o jp4cli.grpc.pb.cc 8 | g++ -std=c++14 `pkg-config --cflags protobuf grpc` -c -o handle_cmd.o handle_cmd.cpp 9 | g++ jp4cli.pb.o jp4cli.grpc.pb.o handle_cmd.o -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc` -lgrpc++_reflection -ldl -o handle_cmd 10 | -------------------------------------------------------------------------------- /cli/jp4cli_pb2_grpc.py: -------------------------------------------------------------------------------- 1 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 2 | import grpc 3 | 4 | import jp4cli_pb2 as jp4cli__pb2 5 | 6 | 7 | class CmdHandlerStub(object): 8 | # missing associated documentation comment in .proto file 9 | pass 10 | 11 | def __init__(self, channel): 12 | """Constructor. 13 | 14 | Args: 15 | channel: A grpc.Channel. 16 | """ 17 | self.SendCmd = channel.unary_unary( 18 | '/jp4cli.CmdHandler/SendCmd', 19 | request_serializer=jp4cli__pb2.CmdRequest.SerializeToString, 20 | response_deserializer=jp4cli__pb2.CmdReply.FromString, 21 | ) 22 | 23 | 24 | class CmdHandlerServicer(object): 25 | # missing associated documentation comment in .proto file 26 | pass 27 | 28 | def SendCmd(self, request, context): 29 | # missing associated documentation comment in .proto file 30 | pass 31 | context.set_code(grpc.StatusCode.UNIMPLEMENTED) 32 | context.set_details('Method not implemented!') 33 | raise NotImplementedError('Method not implemented!') 34 | 35 | 36 | def add_CmdHandlerServicer_to_server(servicer, server): 37 | rpc_method_handlers = { 38 | 'SendCmd': grpc.unary_unary_rpc_method_handler( 39 | servicer.SendCmd, 40 | request_deserializer=jp4cli__pb2.CmdRequest.FromString, 41 | response_serializer=jp4cli__pb2.CmdReply.SerializeToString, 42 | ), 43 | } 44 | generic_handler = grpc.method_handlers_generic_handler( 45 | 'jp4cli.CmdHandler', rpc_method_handlers) 46 | server.add_generic_rpc_handlers((generic_handler,)) 47 | -------------------------------------------------------------------------------- /config/afi-switch-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "Note" : "This is AFI switch cofiguration file", 3 | "AfiSwitchConfig" : { 4 | "Interfaces" : { 5 | "Note" : "Interfaces config", 6 | "if1" : "eth0", 7 | "if2" : "eth1" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /config/aft-target-halp-cfg.json: -------------------------------------------------------------------------------- 1 | [ 2 | "Note" : "This is the cofiguration file for aft target", 3 | "AFTConfig" : { 4 | "aft-server-ip" : "0.0.0.0", 5 | "aft-server-port" : "50051" 6 | } 7 | ] 8 | -------------------------------------------------------------------------------- /config/jp4agent-brcm-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "Note" : "JP4Agent cofiguration file", 3 | "JP4AgentConfig" : { 4 | "PIConfig" : { 5 | "Note" : "JP4Agent's PI server listen address", 6 | "pi-server-address" : "0.0.0.0:50051" 7 | }, 8 | "HostpathConfig" : { 9 | "Note" : "Address where JP4Agent listens for hostpath packets from PacketIO", 10 | "hostpath-server-ip" : "0.0.0.0", 11 | "hostpath-server-port" : 64015 12 | }, 13 | "DevicePktIOConfig" : { 14 | "Note" : "Address where PacketIO listens for hostpath packets from JP4Agent", 15 | "pktio-server-address" : "0.0.0.0:64014" 16 | }, 17 | "DebugConfig" : { 18 | "Note" : "Debug mode", 19 | "debug-mode" : "debug-afi-objects" 20 | }, 21 | "DebugCLIConfig" : { 22 | "Note" : "Debug CLI config", 23 | "cli-server-address" : "0.0.0.0:53421" 24 | }, 25 | "TargetConfig" : { 26 | "Note" : "Target config", 27 | "target-address" : "10.207.66.110", 28 | "config-file" : "/root/JP4Agent/src/targets/aft/config/aft-cfg.json" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /config/jp4agent-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "Note" : "JP4Agent cofiguration file", 3 | "JP4AgentConfig" : { 4 | "PIConfig" : { 5 | "Note" : "JP4Agent's PI server listen address", 6 | "pi-server-address" : "0.0.0.0:50051" 7 | }, 8 | "HostpathConfig" : { 9 | "Note" : "Address where JP4Agent listens for hostpath packets from PacketIO", 10 | "hostpath-server-ip" : "0.0.0.0", 11 | "hostpath-server-port" : 64015 12 | }, 13 | "DevicePktIOConfig" : { 14 | "Note" : "Address where PacketIO listens for hostpath packets from JP4Agent", 15 | "pktio-server-address" : "128.0.0.16:64014" 16 | }, 17 | "DebugConfig" : { 18 | "Note" : "Debug mode", 19 | "debug-mode" : "debug-afi-objects" 20 | }, 21 | "DebugCLIConfig" : { 22 | "Note" : "Debug CLI config", 23 | "cli-server-address" : "0.0.0.0:53421" 24 | }, 25 | "TargetConfig" : { 26 | "Note" : "Target config", 27 | "config-file" : "/root/JP4Agent/src/targets/aft/config/aft-cfg.json" 28 | }, 29 | "JaegerConfig" : { 30 | "Note" : "Jaeger config", 31 | "jaeger-config-file" : "" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/CodingGuidelines.md: -------------------------------------------------------------------------------- 1 | Coding guidelines 2 | =================== 3 | 4 | ``` 5 | TBD 6 | 7 | 8 | ``` 9 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## JP4Agent documentation 2 | 3 | * [Working with VMX](./WorkingWithVMX.md) 4 | * [Jaeger Integration](./Jaeger.md) 5 | -------------------------------------------------------------------------------- /docs/WorkingWithVMX.md: -------------------------------------------------------------------------------- 1 | 2 | ## Working with VMX 3 | 4 | ### Login to VCP 5 | ``` 6 | Console: 7 | telnet localhost 8601 8 | Username: root 9 | Password: JunAFI 10 | 11 | Ssh: 12 | ssh root@ 13 | Password: JunAFI 14 | ``` 15 | 16 | ### Login to VFP 17 | ``` 18 | Console: 19 | telnet localhost 8602 <<< Console 20 | Username: root 21 | Password: root 22 | 23 | Ssh: 24 | ssh pfe@ 25 | Password: pfe 26 | 27 | After logging as user 'pfe', to become root do 'su' (root password: root) 28 | ``` 29 | 30 | 31 | ### Configuring forwarding sandbox 32 | ``` 33 | root@6a7738d10b2a:~# ssh root@ 34 | Password: 35 | Last login: Sat Dec 23 12:20:58 2017 from 172.18.0.4 36 | --- JUNOS 17.3I20171118_2053_sksodhi Kernel 64-bit JNPR-10.3-20170605.150032_fbsd- 37 | root@:~ # cli 38 | root> configure 39 | Entering configuration mode 40 | 41 | [edit] 42 | root# set forwarding-options forwarding-sandbox jp4agent port p1 interface xe-0/0/0:1 43 | 44 | [edit] 45 | root# set forwarding-options forwarding-sandbox jp4agent port p2 interface xe-0/0/0:2 46 | 47 | [edit] 48 | root# 49 | root# show | compare 50 | [edit] 51 | + forwarding-options { 52 | + forwarding-sandbox jp4agent { 53 | + port p1 { 54 | + interface xe-0/0/0:1; 55 | + } 56 | + port p2 { 57 | + interface xe-0/0/0:2; 58 | + } 59 | + } 60 | + } 61 | 62 | [edit] 63 | root# commit 64 | commit complete 65 | 66 | [edit] 67 | root# 68 | ``` 69 | -------------------------------------------------------------------------------- /docs/p4/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | P4 Resources 4 | ============ 5 | * [P4 Language Consortium](https://p4.org/) 6 | * [P4 on GitHub](https://github.com/p4lang/) 7 | -------------------------------------------------------------------------------- /docs/resources/External-tester.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/External-tester.png -------------------------------------------------------------------------------- /docs/resources/JP4Agent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/JP4Agent.png -------------------------------------------------------------------------------- /docs/resources/JP4Agent_layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/JP4Agent_layers.png -------------------------------------------------------------------------------- /docs/resources/JaegerIntegration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/JaegerIntegration.png -------------------------------------------------------------------------------- /docs/resources/README.md: -------------------------------------------------------------------------------- 1 | ## JP4Agent documentation resources 2 | -------------------------------------------------------------------------------- /docs/resources/afi-yang-compilation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/afi-yang-compilation.png -------------------------------------------------------------------------------- /docs/resources/docker-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/docker-setup.png -------------------------------------------------------------------------------- /docs/resources/jp4agent_python_cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/jp4agent_python_cli.png -------------------------------------------------------------------------------- /docs/resources/vmx_with_tester.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/docs/resources/vmx_with_tester.png -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled binary # 2 | ################### 3 | -------------------------------------------------------------------------------- /src/README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | ### Compile jp4agent 8 | ``` 9 | cd build 10 | 11 | To build JPAgent with aft target: 12 | ./make-all-aft.sh 13 | 14 | To build JPAgent with Broadcom target: 15 | 1. Set the following environment variables: 16 | export BCM_HALP_DIR_PATH= 17 | export BCM_SDK_DIR_PATH= 18 | 19 | 2. ./make-all-brcm.sh 20 | 21 | To build JPAgent with null target: 22 | ./make-all-null.sh 23 | ``` 24 | 25 | ### Run jp4agent 26 | ``` 27 | To run JPAgent (aft target): 28 | cd src/targets/aft/bin 29 | ./run-jp4agent 30 | 31 | To run JPAgent (Broadcom target): 32 | cd src/targets/brcm/bin 33 | ./run-jp4agent 34 | 35 | To run JPAgent (null target): 36 | cd src/targets/null/bin 37 | ./run-jp4agent 38 | 39 | ``` 40 | -------------------------------------------------------------------------------- /src/afi/include/AfiCapAction.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapAction.h 5 | /// @brief Afi Content Aware Processor Action Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFICAPACTION_H_ 24 | #define SRC_AFI_INCLUDE_AFICAPACTION_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiCapAction; 33 | using AfiCapActionPtr = std::shared_ptr; 34 | using AfiCapActionWeakPtr = std::weak_ptr; 35 | 36 | class AfiCapAction : public AfiObject 37 | { 38 | public: 39 | explicit AfiCapAction(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiCapAction() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiCapActionPtr &aficapaction) 49 | { 50 | return aficapaction->description(os); 51 | } 52 | 53 | #ifdef SUD 54 | // attached object 55 | protected: 56 | #endif // SUD 57 | juniper::afi_cap_action::AfiCapAction capAction; 58 | }; 59 | 60 | } // namespace AFIHAL 61 | 62 | #endif // SRC_AFI_INCLUDE_AFICAPACTION_H_ 63 | -------------------------------------------------------------------------------- /src/afi/include/AfiCapEntry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapEntry.h 5 | /// @brief Afi Content Aware Processor Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFICAPEntry_H_ 24 | #define SRC_AFI_INCLUDE_AFICAPEntry_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiCapEntry; 33 | using AfiCapEntryPtr = std::shared_ptr; 34 | using AfiCapEntryWeakPtr = std::weak_ptr; 35 | 36 | class AfiCapEntry : public AfiObject 37 | { 38 | public: 39 | explicit AfiCapEntry(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiCapEntry() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiCapEntryPtr &aficapEntry) 49 | { 50 | return aficapEntry->description(os); 51 | } 52 | 53 | protected: 54 | juniper::afi_cap_entry::AfiCapEntry _capEntry; 55 | }; 56 | 57 | } // namespace AFIHAL 58 | 59 | #endif // SRC_AFI_INCLUDE_AFICAPEntry_H_ 60 | -------------------------------------------------------------------------------- /src/afi/include/AfiCapEntryMatch.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapEntryMatch.h 5 | /// @brief Afi Content Aware Processor Entry Match Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFICAPEntryMatch_H_ 24 | #define SRC_AFI_INCLUDE_AFICAPEntryMatch_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiCapEntryMatch; 33 | using AfiCapEntryMatchPtr = std::shared_ptr; 34 | using AfiCapEntryMatchWeakPtr = std::weak_ptr; 35 | 36 | class AfiCapEntryMatch : public AfiObject 37 | { 38 | public: 39 | explicit AfiCapEntryMatch(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiCapEntryMatch() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiCapEntryMatchPtr &aficapEntryMatch) 49 | { 50 | return aficapEntryMatch->description(os); 51 | } 52 | 53 | // attached object 54 | //protected: 55 | juniper::afi_cap_entry_match::AfiCapEntryMatch capEntryMatch; 56 | }; 57 | 58 | } // namespace AFIHAL 59 | 60 | #endif // SRC_AFI_INCLUDE_AFICAPEntryMatch_H_ 61 | -------------------------------------------------------------------------------- /src/afi/include/AfiCapMatch.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapMatch.h 5 | /// @brief Afi Content Aware Processor Match Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFICAPMATCH_H_ 24 | #define SRC_AFI_INCLUDE_AFICAPMATCH_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiCapMatch; 33 | using AfiCapMatchPtr = std::shared_ptr; 34 | using AfiCapMatchWeakPtr = std::weak_ptr; 35 | 36 | class AfiCapMatch : public AfiObject 37 | { 38 | public: 39 | explicit AfiCapMatch(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiCapMatch() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiCapMatchPtr &aficapmatch) 49 | { 50 | return aficapmatch->description(os); 51 | } 52 | 53 | #ifdef SUD 54 | // attached object 55 | protected: 56 | #endif // SUD 57 | juniper::afi_cap_match::AfiCapMatch capMatch; 58 | }; 59 | 60 | } // namespace AFIHAL 61 | 62 | #endif // SRC_AFI_INCLUDE_AFICAPMATCH_H_ 63 | -------------------------------------------------------------------------------- /src/afi/include/AfiDM.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiDM.h 5 | /// @brief Afi Data Model 6 | // 7 | // Created by Sandesh Kumar Sodhi, December 2017 8 | // Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFIDM_H_ 24 | #define SRC_AFI_INCLUDE_AFIDM_H_ 25 | 26 | #include "afi_tree/afi_tree.pb.h" 27 | #include "afi_tree_entry/afi_tree_entry.pb.h" 28 | #include "afi_cap/afi_cap.pb.h" 29 | #include "afi_cap_match/afi_cap_match.pb.h" 30 | #include "afi_cap_action/afi_cap_action.pb.h" 31 | #include "afi_cap_entry/afi_cap_entry.pb.h" 32 | #include "afi_cap_entry_match/afi_cap_entry_match.pb.h" 33 | #include "afi_cap_entry_action/afi_cap_entry_action.pb.h" 34 | #include "afi_encap/afi_encap.pb.h" 35 | #include "afi_encap_entry/afi_encap_entry.pb.h" 36 | #include "afi_tree_encap/afi_tree_encap.pb.h" 37 | #include "afi_tree_encap_entry/afi_tree_encap_entry.pb.h" 38 | 39 | namespace AFIHAL 40 | { 41 | } // namespace AFIHAL 42 | 43 | #endif // SRC_AFI_INCLUDE_AFIDM_H_ 44 | -------------------------------------------------------------------------------- /src/afi/include/AfiEncap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiEncap.h 5 | /// @brief Afi packet encapsulation 6 | // 7 | // Created by Sudheendra Gopinath, August 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFIENCAP_H_ 24 | #define SRC_AFI_INCLUDE_AFIENCAP_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiEncap; 33 | using AfiEncapPtr = std::shared_ptr; 34 | using AfiEncapWeakPtr = std::weak_ptr; 35 | 36 | class AfiEncap : public AfiObject 37 | { 38 | public: 39 | explicit AfiEncap(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiEncap() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiEncapPtr &afiencap) 49 | { 50 | return afiencap->description(os); 51 | } 52 | 53 | protected: 54 | juniper::afi_encap::AfiEncap _encap; 55 | }; 56 | 57 | } // namespace AFIHAL 58 | 59 | #endif // SRC_AFI_INCLUDE_AFIENCAP_H_ 60 | -------------------------------------------------------------------------------- /src/afi/include/AfiEncapEntry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiEncapEntry.h 5 | /// @brief Afi Packet Encapsulation Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFIENCAPEntry_H_ 24 | #define SRC_AFI_INCLUDE_AFIENCAPEntry_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiEncapEntry; 33 | using AfiEncapEntryPtr = std::shared_ptr; 34 | using AfiEncapEntryWeakPtr = std::weak_ptr; 35 | 36 | class AfiEncapEntry : public AfiObject 37 | { 38 | public: 39 | explicit AfiEncapEntry(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiEncapEntry() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiEncapEntryPtr &afiEncapEntry) 49 | { 50 | return afiEncapEntry->description(os); 51 | } 52 | 53 | protected: 54 | juniper::afi_encap_entry::AfiEncapEntry _encapEntry; 55 | }; 56 | 57 | } // namespace AFIHAL 58 | 59 | #endif // SRC_AFI_INCLUDE_AFIENCAPEntry_H_ 60 | -------------------------------------------------------------------------------- /src/afi/include/AfiTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiTree.h 5 | /// @brief Afi Tree 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFITREE_H_ 24 | #define SRC_AFI_INCLUDE_AFITREE_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiTree; 33 | using AfiTreePtr = std::shared_ptr; 34 | using AfiTreeWeakPtr = std::weak_ptr; 35 | 36 | class AfiTree : public AfiObject 37 | { 38 | public: 39 | explicit AfiTree(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiTree() {} 42 | 43 | ::juniper::enums::AfiTreeAfiTreeType type() { return _tree.type(); } 44 | 45 | // 46 | // Debug 47 | // 48 | std::ostream &description(std::ostream &os) const; 49 | 50 | friend std::ostream &operator<<(std::ostream &os, const AfiTreePtr &afitree) 51 | { 52 | return afitree->description(os); 53 | } 54 | 55 | protected: 56 | juniper::afi_tree::AfiTree _tree; 57 | }; 58 | 59 | } // namespace AFIHAL 60 | 61 | #endif // SRC_AFI_INCLUDE_AFITREE_H_ 62 | -------------------------------------------------------------------------------- /src/afi/include/AfiTreeEncapEntry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiTreeEncapEntry.h 5 | /// @brief Afi Tree and Packet Encapsulation Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFITREEENCAPEntry_H_ 24 | #define SRC_AFI_INCLUDE_AFITREEENCAPEntry_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiTreeEncapEntry; 33 | using AfiTreeEncapEntryPtr = std::shared_ptr; 34 | using AfiTreeEncapEntryWeakPtr = std::weak_ptr; 35 | 36 | class AfiTreeEncapEntry : public AfiObject 37 | { 38 | public: 39 | explicit AfiTreeEncapEntry(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiTreeEncapEntry() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream &os, const AfiTreeEncapEntryPtr &afiTreeEncapEntry) 49 | { 50 | return afiTreeEncapEntry->description(os); 51 | } 52 | 53 | protected: 54 | juniper::afi_tree_encap_entry::AfiTreeEncapEntry _treeEncapEntry; 55 | }; 56 | 57 | } // namespace AFIHAL 58 | 59 | #endif // SRC_AFI_INCLUDE_AFITREEENCAPEntry_H_ 60 | -------------------------------------------------------------------------------- /src/afi/include/AfiTreeEntry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiTreeEntry.h 5 | /// @brief Afi tree entry 6 | // 7 | // Created by Sandesh Kumar Sodhi, February 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_AFI_INCLUDE_AFITREEENTRY_H_ 24 | #define SRC_AFI_INCLUDE_AFITREEENTRY_H_ 25 | 26 | #include 27 | #include "AfiDM.h" 28 | #include "AfiObject.h" 29 | 30 | namespace AFIHAL 31 | { 32 | class AfiTreeEntry; 33 | using AfiTreeEntryPtr = std::shared_ptr; 34 | using AfiTreeEntryWeakPtr = std::weak_ptr; 35 | 36 | class AfiTreeEntry : public AfiObject 37 | { 38 | public: 39 | explicit AfiTreeEntry(const AfiJsonResource &jsonRes); 40 | 41 | ~AfiTreeEntry() {} 42 | 43 | // 44 | // Debug 45 | // 46 | std::ostream &description(std::ostream &os) const; 47 | 48 | friend std::ostream &operator<<(std::ostream & os, 49 | const AfiTreeEntryPtr &afitree) 50 | { 51 | return afitree->description(os); 52 | } 53 | 54 | protected: 55 | juniper::afi_tree_entry::AfiTreeEntry _treeEntry; 56 | }; 57 | 58 | } // namespace AFIHAL 59 | 60 | #endif // SRC_AFI_INCLUDE_AFITREEENTRY_H_ 61 | -------------------------------------------------------------------------------- /src/afi/src/AfiCapAction.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapAction.cpp 5 | /// @brief Afi Content Aware Processor Action Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiCapAction.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiCapAction::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiCapAction _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiCapAction::AfiCapAction(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | capAction.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "capAction.ByteSize(): " << capAction.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiCapEntry.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapEntry.cpp 5 | /// @brief Afi Content Aware Processor Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiCapEntry.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiCapEntry::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiCapEntry _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiCapEntry::AfiCapEntry(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | _capEntry.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "capEntry.ByteSize(): " << _capEntry.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiCapEntryAction.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapEntryAction.cpp 5 | /// @brief Afi Content Aware Processor Entry Action Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiCapEntryAction.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiCapEntryAction::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiCapEntryAction _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiCapEntryAction::AfiCapEntryAction(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | capEntryAction.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "capEntryAction.ByteSize(): " << capEntryAction.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiCapEntryMatch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapEntryMatch.cpp 5 | /// @brief Afi Content Aware Processor Entry Match Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiCapEntryMatch.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiCapEntryMatch::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiCapEntryMatch _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiCapEntryMatch::AfiCapEntryMatch(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | capEntryMatch.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "capEntryMatch.ByteSize(): " << capEntryMatch.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiCapMatch.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiCapMatch.cpp 5 | /// @brief Afi Content Aware Processor Match Set 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiCapMatch.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiCapMatch::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiCapMatch _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiCapMatch::AfiCapMatch(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | capMatch.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "cap.ByteSize(): " << capMatch.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiEncapEntry.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiEncapEntry.cpp 5 | /// @brief Afi Packet Encapsulation Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiEncapEntry.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiEncapEntry::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiEncapEntry _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiEncapEntry::AfiEncapEntry(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | _encapEntry.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "encapEntry.ByteSize(): " << _encapEntry.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/afi/src/AfiJsonResource.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiJsonResource.cpp 5 | /// @brief Afi Json Resource 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiJsonResource.h" 24 | #include 25 | 26 | namespace AFIHAL 27 | { 28 | // 29 | // Description 30 | // 31 | std::ostream & 32 | AfiJsonResource::description(std::ostream &os) const 33 | { 34 | os << "_________ AfiJsonResource _______" << std::endl; 35 | os << "Name :" << this->name() << std::endl; 36 | os << "Id :" << this->id() << std::endl; 37 | os << "Type :" << this->type() << std::endl; 38 | os << "Object String :" << this->objStr() << std::endl; 39 | return os; 40 | } 41 | 42 | } // namespace AFIHAL 43 | -------------------------------------------------------------------------------- /src/afi/src/AfiTreeEncapEntry.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AfiTreeEncapEntry.cpp 5 | /// @brief Afi Tree and Packet Encapsulation Entry 6 | // 7 | // Created by Sudheendra Gopinath, June 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "AfiTreeEncapEntry.h" 24 | #include 25 | #include 26 | 27 | #include "Log.h" 28 | #include "Utils.h" 29 | #include "JaegerLog.h" 30 | 31 | namespace AFIHAL 32 | { 33 | // 34 | // Description 35 | // 36 | std::ostream & 37 | AfiTreeEncapEntry::description(std::ostream &os) const 38 | { 39 | os << "_________ AfiTreeEncapEntry _______" << std::endl; 40 | return os; 41 | } 42 | 43 | AfiTreeEncapEntry::AfiTreeEncapEntry(const AfiJsonResource &jsonRes) : AfiObject(jsonRes) 44 | { 45 | // TBD: FIXME magic number 5000 46 | char bytes_decoded[5000]; 47 | memset(bytes_decoded, 0, sizeof(bytes_decoded)); 48 | int num_decoded_bytes = 49 | base64_decode(jsonRes.objStr(), bytes_decoded, 5000); 50 | _treeEncapEntry.ParseFromArray(bytes_decoded, num_decoded_bytes); 51 | 52 | Log(DEBUG) << "num_decoded_bytes: " << num_decoded_bytes; 53 | Log(DEBUG) << "treeEncapEntry.ByteSize(): " << _treeEncapEntry.ByteSize(); 54 | } 55 | 56 | } // namespace AFIHAL 57 | -------------------------------------------------------------------------------- /src/config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # YAML config file for Jaeger tracing 3 | # 4 | # Created by Manmeet Singh, January 2018 5 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 6 | # 7 | # All rights reserved. 8 | # 9 | # Notice and Disclaimer: This code is licensed to you under the Apache 10 | # License 2.0 (the "License"). You may not use this code except in compliance 11 | # with the License. This code is not an official Juniper product. You can 12 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Third-Party Code: This code may depend on other components under separate 15 | # copyright notice and license terms. Your use of the source code for those 16 | # components is subject to the terms and conditions of the respective license 17 | # as noted in the Third-Party source code file. 18 | # 19 | 20 | # 21 | # Please update the IP address of Jaeger backend server in localAgentHostPort 22 | # and hostPort before launching JP4Agent 23 | # 24 | 25 | disabled: false 26 | 27 | sampler: 28 | type: const 29 | param: 1 30 | 31 | reporter: 32 | queueSize: 100 33 | bufferFlushInterval: 10 34 | logSpans: true 35 | localAgentHostPort: 10.102.144.109:6831 36 | 37 | headers: 38 | jaegerDebugHeader: debug-id 39 | jaegerBaggageHeader: baggage 40 | TraceContextHeaderName: trace-id 41 | traceBaggageHeaderPrefix: "testctx-" 42 | 43 | baggage_restrictions: 44 | denyBaggageOnInitializationFailure: false 45 | hostPort: 10.102.144.109:5778 46 | refreshInterval: 10 -------------------------------------------------------------------------------- /src/pi/include/CLIService.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file CLIServer.h 5 | /// @brief Debug CLI command handler service 6 | // 7 | // Created by Karthikeyan Sivaraj, February 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include 24 | #include "cli/jp4cli.grpc.pb.h" 25 | 26 | using grpc::Server; 27 | using grpc::ServerBuilder; 28 | using grpc::ServerContext; 29 | using grpc::Status; 30 | 31 | using jp4cli::CmdHandler; 32 | using jp4cli::CmdReply; 33 | using jp4cli::CmdRequest; 34 | 35 | class CmdHandlerSvcImpl final : public CmdHandler::Service 36 | { 37 | Status SendCmd(ServerContext *context, const CmdRequest *req, 38 | CmdReply *reply) override; 39 | }; 40 | 41 | class CLIService 42 | { 43 | private: 44 | const std::string _cli_serv_addr; 45 | CmdHandlerSvcImpl _service; 46 | 47 | void runGrpcServer(); 48 | 49 | public: 50 | explicit CLIService(const std::string &serv_addr) 51 | : _cli_serv_addr(serv_addr) 52 | { 53 | } 54 | 55 | void startCLIService(); 56 | }; 57 | -------------------------------------------------------------------------------- /src/pi/include/PI.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file PI.h 5 | /// @brief PI 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __PI__ 24 | #define __PI__ 25 | 26 | #include 27 | #include 28 | #include "pvtPI.h" 29 | 30 | class PI; 31 | using PIUPtr = std::unique_ptr; 32 | 33 | class PI 34 | { 35 | public: 36 | PI(const std::string &piServAddr, uint16_t hpUdpPort, 37 | const std::string &pktIOListenAddr, const std::string &cliServAddr) 38 | { 39 | _piServer = std::make_unique(piServAddr, hpUdpPort, 40 | pktIOListenAddr, cliServAddr); 41 | } 42 | 43 | void init() 44 | { 45 | _piServer->startPIServer(); 46 | _piServer->startPktIOHandler(); 47 | _piServer->startDbgCLIServer(); 48 | } 49 | 50 | private: 51 | PIServerUPtr _piServer; 52 | }; 53 | 54 | #endif // __PI__ 55 | -------------------------------------------------------------------------------- /src/pi/include/pvtPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file pvtPI.h 5 | /// @brief prirave PI declaration and includes 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __pvtPI__ 24 | #define __pvtPI__ 25 | 26 | #include 27 | #include 28 | 29 | #include "Afi.h" 30 | #include "Log.h" 31 | #include "Utils.h" 32 | #include "google/rpc/code.pb.h" 33 | #include "p4/tmp/p4config.pb.h" 34 | #ifdef UBUNTU 35 | #include "p4runtime.grpc.pb.h" 36 | #include "p4runtime.pb.h" 37 | #else 38 | #include "p4runtime_wrl.grpc.pb.h" 39 | #include "p4runtime_wrl.pb.h" 40 | #endif 41 | #include "uint128.h" 42 | 43 | using SandboxId = uint16_t; ///< Sandbox Id 44 | using DevicePortIndex = uint16_t; ///< Device port index 45 | 46 | using StreamChannelReaderWriter = 47 | grpc::ServerReaderWriter; 49 | 50 | using grpc::Server; 51 | using grpc::ServerBuilder; 52 | using grpc::ServerContext; 53 | using grpc::ServerReaderWriter; 54 | using grpc::ServerWriter; 55 | using grpc::Status; 56 | using grpc::StatusCode; 57 | 58 | #include "P4Info.h" 59 | #include "P4RuntimeService.h" 60 | #include "PIServer.h" 61 | 62 | #endif // __pvtPI__ 63 | -------------------------------------------------------------------------------- /src/pi/protos/.gitignore: -------------------------------------------------------------------------------- 1 | # grpc/protobuf generated files # 2 | ################### 3 | *.pb.cc 4 | *.pb.h 5 | -------------------------------------------------------------------------------- /src/pi/protos/cli/jp4cli.proto: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file jp4cli.proto 5 | /// @brief CLI service for JP4Agent 6 | // 7 | // Created by Karthikeyan Sivaraj, February 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | syntax = "proto3"; 24 | 25 | package jp4cli; 26 | 27 | service CmdHandler { 28 | rpc SendCmd (CmdRequest) returns (CmdReply) {} 29 | } 30 | 31 | message CmdRequest { 32 | string cmdstr = 1; 33 | } 34 | 35 | message CmdReply { 36 | int32 status = 1; 37 | string cmdout = 2; 38 | } 39 | -------------------------------------------------------------------------------- /src/pi/protos/p4/tmp/p4config.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2013-present Barefoot Networks, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | // This package is temporary. 18 | 19 | package p4.tmp; 20 | 21 | // p4-device specific config 22 | message P4DeviceConfig { 23 | message Extras { 24 | map kv = 1; 25 | } 26 | bool reassign = 1; 27 | Extras extras = 2; 28 | bytes device_data = 3; 29 | }; 30 | -------------------------------------------------------------------------------- /src/pi/protos/p4info.proto: -------------------------------------------------------------------------------- 1 | p4/config/p4info.proto -------------------------------------------------------------------------------- /src/pi/protos/status.proto: -------------------------------------------------------------------------------- 1 | google/rpc/status.proto -------------------------------------------------------------------------------- /src/pi/src/ControllerConnection.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file JP4Agent.cpp 5 | /// @brief Juniper P4 Agent 6 | // 7 | // Created by Sandesh Kumar Sodhi, November 2017 8 | // Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "ControllerConnection.h" 24 | 25 | ControllerConnection controller_conn; 26 | 27 | -------------------------------------------------------------------------------- /src/pi/src/PI.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file PI.cpp 5 | /// @brief PI 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "pvtPI.h" 24 | #include "PI.h" 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/targets/aft/aft/README.md: -------------------------------------------------------------------------------- 1 | AFT 2 | === 3 | -------------------------------------------------------------------------------- /src/targets/aft/aft/include/Aft.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Aft.h 5 | /// @brief Aft includes 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_TARGETS_AFT_AFT_INCLUDE_AFT_H_ 24 | #define SRC_TARGETS_AFT_AFT_INCLUDE_AFT_H_ 25 | 26 | #include 27 | 28 | extern const std::string _aft_debugmode; 29 | 30 | #include "Afi.h" 31 | #include "AftClient.h" 32 | #include "AftDevice.h" 33 | #include "AftObject.h" 34 | #include "AftTree.h" 35 | #include "AftTreeEntry.h" 36 | #include "Log.h" 37 | #include "Utils.h" 38 | 39 | AFIHAL::AfiDeviceUPtr createDevice(const std::string &name); 40 | 41 | namespace AFTHALP 42 | { 43 | } // namespace AFTHALP 44 | 45 | #endif // SRC_TARGETS_AFT_AFT_INCLUDE_AFT_H_ 46 | -------------------------------------------------------------------------------- /src/targets/aft/aft/include/AftDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AftDevice.h 5 | /// @brief Aft Device 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_TARGETS_AFT_AFT_INCLUDE_AFTDEVICE_H_ 24 | #define SRC_TARGETS_AFT_AFT_INCLUDE_AFTDEVICE_H_ 25 | 26 | #include 27 | #include 28 | #include "Aft.h" 29 | 30 | namespace AFTHALP 31 | { 32 | // 33 | // AftDevice 34 | // 35 | 36 | class AftDevice; 37 | using AftDeviceUPtr = std::unique_ptr; 38 | using AftDevicePtr = std::shared_ptr; 39 | using AftDeviceWeakPtr = std::weak_ptr; 40 | 41 | class AftDevice final : public AFIHAL::AfiDevice 42 | { 43 | public: 44 | // 45 | // Constructor and destructor 46 | // 47 | explicit AftDevice(const std::string &name); 48 | ~AftDevice(); 49 | 50 | static AftDeviceUPtr create(const std::string &newName); 51 | void destroy(); 52 | 53 | void setObjectCreators(); 54 | }; 55 | 56 | } // namespace AFTHALP 57 | 58 | #endif // SRC_TARGETS_AFT_AFT_INCLUDE_AFTDEVICE_H_ 59 | -------------------------------------------------------------------------------- /src/targets/aft/aft/src/Aft.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Aft.cpp 5 | /// @brief Aft 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "Aft.h" 24 | #include 25 | 26 | AFIHAL::AfiDeviceUPtr 27 | createDevice(const std::string &name) 28 | { 29 | Log(DEBUG) << "___ createDevice___"; 30 | return AFTHALP::AftDevice::create(name); 31 | } 32 | 33 | // const std::string _aft_debugmode = "no-aft-server"; 34 | const std::string _aft_debugmode = ""; 35 | namespace AFTHALP 36 | { 37 | } // namespace AFTHALP 38 | -------------------------------------------------------------------------------- /src/targets/aft/aft/src/AftObject.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file AftTree.h 5 | /// @brief Aft Tree 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | namespace AFTHALP 24 | { 25 | } // namespace AFTHALP 26 | -------------------------------------------------------------------------------- /src/targets/aft/bin/.gitignore: -------------------------------------------------------------------------------- 1 | jp4agent 2 | -------------------------------------------------------------------------------- /src/targets/aft/bin/gdb-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=/root/VMX/afi/lib 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/aft/aft/obj 12 | 13 | gdb $JP4AGENT_LOC/src/targets/aft/bin/jp4agent 14 | -------------------------------------------------------------------------------- /src/targets/aft/bin/run-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=/root/VMX/afi/lib 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/aft/aft/obj 12 | 13 | if [ "$#" -eq 1 ]; then 14 | # 15 | # If provided first arguments is the log file 16 | # 17 | LOG_FILE=$1 18 | $JP4AGENT_LOC/src/targets/aft/bin/jp4agent | tee $LOG_FILE 19 | else 20 | #ldd $JP4AGENT_LOC/src/targets/aft/obj/jp4agent 21 | #LD_DEBUG=all $JP4AGENT_LOC/src/targets/aft/obj/jp4agent 22 | #gdb $JP4AGENT_LOC/src/targets/aft/obj/jp4agent 23 | $JP4AGENT_LOC/src/targets/aft/bin/jp4agent 24 | fi 25 | -------------------------------------------------------------------------------- /src/targets/aft/config/aft-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "Note" : "Cofiguration file for target aft", 3 | "AFTConfig" : { 4 | "aft-server-address" : "0.0.0.0:50051" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/targets/brcm/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/src/targets/brcm/.gitkeep -------------------------------------------------------------------------------- /src/targets/brcm/bin/gdb-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/brcm/brcm/obj 11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BCM_HALP_DIR_PATH/obj/ 12 | 13 | gdb $JP4AGENT_LOC/src/targets/brcm/bin/jp4agent 14 | -------------------------------------------------------------------------------- /src/targets/brcm/bin/run-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=/usr/local/lib 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/brcm/brcm/obj 12 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BCM_HALP_DIR_PATH/obj/ 13 | 14 | if [ "$#" -eq 1 ]; then 15 | # 16 | # If provided first arguments is the log file 17 | # 18 | $JP4AGENT_LOC/src/targets/brcm/bin/jp4agent | tee $1 19 | else 20 | $JP4AGENT_LOC/src/targets/brcm/bin/jp4agent 21 | fi 22 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/README.md: -------------------------------------------------------------------------------- 1 | BRCM TARGET 2 | ============ 3 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/include/Brcm.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Brcm.h 5 | /// @brief Brcm target includes 6 | // 7 | // Created by Sudheendra Gopinath, March 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __Brcm__ 24 | #define __Brcm__ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "Log.h" 32 | #include "Utils.h" 33 | #include "Afi.h" 34 | #include "BrcmFp.h" 35 | #include "BrcmDevice.h" 36 | #include "BrcmObject.h" 37 | #include "BrcmTree.h" 38 | #include "BrcmTreeEntry.h" 39 | #include "BrcmCap.h" 40 | #include "BrcmCapEntry.h" 41 | 42 | #include "BrcmRpc.h" 43 | 44 | AFIHAL::AfiDeviceUPtr createDevice(const std::string &name); 45 | 46 | namespace BRCMHALP { 47 | } // namespace BRCMHALP 48 | 49 | #endif // __Brcm__ 50 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/include/BrcmDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file BrcmDevice.h 5 | /// @brief Brcm Device 6 | // 7 | // Created by Sudheendra Gopinath, March 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __BrcmDevice__ 24 | #define __BrcmDevice__ 25 | 26 | #include "Brcm.h" 27 | #include "BrcmInit.h" 28 | #include "BrcmRpc.h" 29 | 30 | namespace BRCMHALP { 31 | 32 | // 33 | // BrcmDevice 34 | // 35 | 36 | class BrcmDevice; 37 | using BrcmDeviceUPtr = std::unique_ptr; 38 | using BrcmDevicePtr = std::shared_ptr; 39 | using BrcmDeviceWeakPtr = std::weak_ptr; 40 | 41 | class BrcmDevice final : public AFIHAL::AfiDevice 42 | { 43 | public: 44 | BrcmDevice(const std::string &name); 45 | ~BrcmDevice(); 46 | 47 | static BrcmDeviceUPtr create(const std::string &newName); 48 | void destroy(); 49 | 50 | private: 51 | BrcmRpcPtr _brpc; 52 | //BrcmPlusPtr _brcmPlus; 53 | 54 | void setObjectCreators(); 55 | 56 | void brpcStart(std::string dstIp); 57 | 58 | void brpcStop(); 59 | 60 | //void setBrcmHandle(); 61 | }; 62 | 63 | } // namespace BRCMHALP 64 | 65 | #endif // __BrcmDevice__ 66 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/include/BrcmTree.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file BrcmTree.h 5 | /// @brief Brcm Tree Object 6 | // 7 | // Created by Sudheendra Gopinath, March 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __BrcmTree__ 24 | #define __BrcmTree__ 25 | 26 | namespace BRCMHALP { 27 | 28 | class BrcmTree; 29 | using BrcmTreePtr = std::shared_ptr; 30 | using BrcmTreeWeakPtr = std::weak_ptr; 31 | 32 | class BrcmTree: public BrcmObjectTemplate 33 | { 34 | using BrcmObjectTemplate::BrcmObjectTemplate; 35 | public: 36 | //BrcmTree (const AfiJsonResource &jsonRes) : AfiTree(jsonRes) {} 37 | //~BrcmTree () {} 38 | 39 | /// 40 | /// @brief Create the hardware state 41 | /// 42 | void _bind() override; 43 | 44 | // 45 | // @brief Debug 46 | // 47 | std::ostream &description (std::ostream &os) const; 48 | 49 | friend std::ostream &operator<< (std::ostream &os, 50 | const BrcmTreePtr &BrcmTree) { 51 | return BrcmTree->description(os); 52 | } 53 | }; 54 | 55 | } // namespace BRCMHALP 56 | 57 | #endif // __BrcmTree__ 58 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/include/BrcmTreeEntry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file BrcmTreeEntry.h 5 | /// @brief Brcm tree entry 6 | // 7 | // Created by Sudheendra Gopinath, March 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef __BRCMHALP_BrcmTreeEntry__ 24 | #define __BRCMHALP_BrcmTreeEntry__ 25 | 26 | namespace BRCMHALP { 27 | 28 | class BrcmTreeEntry; 29 | using BrcmTreeEntryPtr = std::shared_ptr; 30 | using BrcmTreeEntryWeakPtr = std::weak_ptr; 31 | 32 | class BrcmTreeEntry: public BrcmObjectTemplate 33 | { 34 | using BrcmObjectTemplate::BrcmObjectTemplate; 35 | public: 36 | //BrcmTreeEntry (const AfiJsonResource &jsonRes) : AfiTree(jsonRes) {} 37 | //~BrcmTreeEntry () {} 38 | 39 | /// 40 | /// @brief Create the hardware state 41 | /// 42 | void _bind() override; 43 | 44 | // 45 | // @brief Debug 46 | // 47 | std::ostream &description (std::ostream &os) const; 48 | 49 | friend std::ostream &operator<< (std::ostream &os, 50 | const BrcmTreeEntryPtr &BrcmTreeEntry) { 51 | return BrcmTreeEntry->description(os); 52 | } 53 | }; 54 | 55 | } // namespace BRCMHALP 56 | 57 | #endif // __BRCMHALP_BrcmTreeEntry__ 58 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/src/Brcm.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Brcm.cpp 5 | /// @brief Brcm Device Handling 6 | // 7 | // Created by Sudheendra Gopinath, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "Brcm.h" 24 | 25 | AFIHAL::AfiDeviceUPtr 26 | createDevice (const std::string &name) 27 | { 28 | Log(DEBUG) << "___ createDevice_______"; 29 | return BRCMHALP::BrcmDevice::create(name); 30 | } 31 | 32 | namespace BRCMHALP { 33 | } // namespace BRCMHALP 34 | -------------------------------------------------------------------------------- /src/targets/brcm/brcm/src/BrcmObject.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file BrcmObject.cpp 5 | /// @brief Brcm Object 6 | // 7 | // Created by Sudheendra Gopinath, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | 24 | namespace BRCMHALP { 25 | } // namespace BRCMHALP 26 | -------------------------------------------------------------------------------- /src/targets/null/README.md: -------------------------------------------------------------------------------- 1 | Target NULL 2 | ============ 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/targets/null/bin/.gitignore: -------------------------------------------------------------------------------- 1 | jp4agent 2 | -------------------------------------------------------------------------------- /src/targets/null/bin/gdb-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/null/null/obj 11 | 12 | gdb $JP4AGENT_LOC/src/targets/null/bin/jp4agent 13 | -------------------------------------------------------------------------------- /src/targets/null/bin/run-jp4agent: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../../.. 4 | export LD_LIBRARY_PATH=/usr/local/lib 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/VMX/afi/lib 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 11 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 12 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/targets/null/null/obj 13 | 14 | if [ "$#" -eq 1 ]; then 15 | # 16 | # If provided first arguments is the log file 17 | # 18 | $JP4AGENT_LOC/src/targets/null/bin/jp4agent | tee $1 19 | else 20 | #ldd $JP4AGENT_LOC/src/targets/null/obj/jp4agent 21 | #LD_DEBUG=all $JP4AGENT_LOC/src/targets/null/obj/jp4agent 22 | #gdb $JP4AGENT_LOC/src/targets/null/obj/jp4agent 23 | $JP4AGENT_LOC/src/targets/null/bin/jp4agent 24 | fi 25 | -------------------------------------------------------------------------------- /src/targets/null/config/null-target-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "Note" : "Cofiguration file for null target", 3 | "NullConfig" : { 4 | "device-log-fle" : "null-device.log" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/targets/null/null/README.md: -------------------------------------------------------------------------------- 1 | NULL TARGET 2 | ============ 3 | -------------------------------------------------------------------------------- /src/targets/null/null/include/Null.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Null.h 5 | /// @brief Null target includes 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_TARGETS_NULL_NULL_INCLUDE_NULL_H_ 24 | #define SRC_TARGETS_NULL_NULL_INCLUDE_NULL_H_ 25 | 26 | #include 27 | #include "Afi.h" 28 | #include "Log.h" 29 | #include "NullDevice.h" 30 | #include "NullObject.h" 31 | #include "NullTree.h" 32 | #include "NullTreeEntry.h" 33 | #include "Utils.h" 34 | 35 | AFIHAL::AfiDeviceUPtr createDevice(const std::string &name); 36 | 37 | namespace NULLHALP 38 | { 39 | } // namespace NULLHALP 40 | 41 | #endif // SRC_TARGETS_NULL_NULL_INCLUDE_NULL_H_ 42 | -------------------------------------------------------------------------------- /src/targets/null/null/include/NullDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file NullDevice.h 5 | /// @brief Null Device 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #ifndef SRC_TARGETS_NULL_NULL_INCLUDE_NULLDEVICE_H_ 24 | #define SRC_TARGETS_NULL_NULL_INCLUDE_NULLDEVICE_H_ 25 | 26 | #include 27 | #include 28 | #include "Afi.h" 29 | #include "NullTree.h" 30 | #include "NullTreeEntry.h" 31 | 32 | namespace NULLHALP 33 | { 34 | // 35 | // NullDevice 36 | // 37 | 38 | class NullDevice; 39 | using NullDeviceUPtr = std::unique_ptr; 40 | using NullDevicePtr = std::shared_ptr; 41 | using NullDeviceWeakPtr = std::weak_ptr; 42 | 43 | class NullDevice final : public AFIHAL::AfiDevice 44 | { 45 | public: 46 | // 47 | // Constructor and destructor 48 | // 49 | explicit NullDevice(const std::string &name); 50 | ~NullDevice(); 51 | 52 | static NullDeviceUPtr create(const std::string &newName); 53 | void destroy(); 54 | 55 | void setObjectCreators(); 56 | }; 57 | 58 | } // namespace NULLHALP 59 | 60 | #endif // SRC_TARGETS_NULL_NULL_INCLUDE_NULLDEVICE_H_ 61 | -------------------------------------------------------------------------------- /src/targets/null/null/src/Null.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file Null.cpp 5 | /// @brief Null 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "Null.h" 24 | #include 25 | 26 | AFIHAL::AfiDeviceUPtr 27 | createDevice(const std::string &name) 28 | { 29 | Log(DEBUG) << "___ createDevice_______"; 30 | return NULLHALP::NullDevice::create(name); 31 | } 32 | 33 | namespace NULLHALP 34 | { 35 | } // namespace NULLHALP 36 | -------------------------------------------------------------------------------- /src/targets/null/null/src/NullDevice.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file NullDevice.cpp 5 | /// @brief Null Device 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | #include "NullDevice.h" 24 | #include 25 | #include 26 | 27 | namespace NULLHALP 28 | { 29 | void 30 | NullDevice::setObjectCreators() 31 | { 32 | Log(DEBUG) << "___ NullDevice::setObjectCreators _______"; 33 | setObjectCreator("afi-tree", &NullTree::create); 34 | setObjectCreator("afi-tree-entry", &NullTreeEntry::create); 35 | } 36 | 37 | // 38 | // Factory creation method, constructors and destructors 39 | // 40 | NullDeviceUPtr 41 | NullDevice::create(const std::string &name) 42 | { 43 | Log(DEBUG) << "___ NullDevice::create ___"; 44 | auto device = std::make_unique(name); 45 | 46 | // 47 | // Create the engine mount 48 | // 49 | device->setObjectCreators(); 50 | 51 | return device; 52 | } 53 | 54 | void 55 | NullDevice::destroy() 56 | { 57 | } 58 | 59 | NullDevice::NullDevice(const std::string &name) : AfiDevice(name) 60 | { 61 | // 62 | // create() function does all the work 63 | // 64 | } 65 | 66 | NullDevice::~NullDevice() 67 | { 68 | destroy(); 69 | } 70 | 71 | } // namespace NULLHALP 72 | -------------------------------------------------------------------------------- /src/targets/null/null/src/NullObject.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file NullTree.h 5 | /// @brief Null Tree 6 | // 7 | // Created by Sandesh Kumar Sodhi, January 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | namespace NULLHALP 24 | { 25 | } // namespace NULLHALP 26 | -------------------------------------------------------------------------------- /src/utils/include/JaegerLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // Juniper P4 Agent 3 | // 4 | /// @file JaegerLog.h 5 | /// @brief Jaeger Logging interface 6 | // 7 | // Created by Manmeet Singh, March 2018 8 | // Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 9 | // 10 | // All rights reserved. 11 | // 12 | // Notice and Disclaimer: This code is licensed to you under the Apache 13 | // License 2.0 (the "License"). You may not use this code except in compliance 14 | // with the License. This code is not an official Juniper product. You can 15 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | // 17 | // Third-Party Code: This code may depend on other components under separate 18 | // copyright notice and license terms. Your use of the source code for those 19 | // components is subject to the terms and conditions of the respective license 20 | // as noted in the Third-Party source code file. 21 | // 22 | 23 | 24 | #ifndef JaegerLog_h 25 | #define JaegerLog_h 26 | 27 | #include 28 | #include 29 | #include 30 | #ifdef OPENTRACING 31 | #include 32 | #endif // OPENTRACING 33 | 34 | 35 | class JaegerLog 36 | { 37 | private: 38 | static JaegerLog* _instance; 39 | #ifdef OPENTRACING 40 | std::unique_ptr _span; 41 | #endif // OPENTRACING 42 | JaegerLog(); 43 | ~JaegerLog(); 44 | public: 45 | /* Static access method. */ 46 | static JaegerLog* getInstance(); 47 | void initTracing(std::string configFileName); 48 | void teardownTracing(); 49 | void startSpan(const std::string spanName); 50 | void finishSpan(); 51 | void Log(const std::string type, std::string val); 52 | }; 53 | 54 | 55 | #endif /* JaegerLog_h */ 56 | -------------------------------------------------------------------------------- /src/utils/src/uint128.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-present Barefoot Networks, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* 17 | * Antonin Bas (antonin@barefootnetworks.com) 18 | * 19 | */ 20 | 21 | #include "uint128.h" 22 | 23 | #include 24 | #include 25 | 26 | namespace { 27 | 28 | // Saves the internal state of a stream and restores it in the destructor 29 | struct StreamStateSaver final { 30 | explicit StreamStateSaver(std::ios &s) // NOLINT(runtime/references) 31 | : ref(s) { 32 | state.copyfmt(s); 33 | } 34 | 35 | ~StreamStateSaver() { 36 | ref.copyfmt(state); 37 | } 38 | 39 | std::ios &ref; 40 | std::ios state{nullptr}; 41 | }; 42 | 43 | } // namespace 44 | 45 | std::ostream &operator<<(std::ostream &out, const Uint128 &n) { 46 | StreamStateSaver state_saver(out); 47 | out << "0x"; 48 | if (n.high_ == 0) 49 | out << std::hex << n.low_; 50 | else 51 | out << std::hex << n.high_ << std::setw(16) << std::setfill('0') << n.low_; 52 | return out; 53 | } 54 | -------------------------------------------------------------------------------- /test/controller/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled binary # 2 | ################### 3 | controller 4 | -------------------------------------------------------------------------------- /test/controller/README: -------------------------------------------------------------------------------- 1 | README 2 | 3 | -------------------------------------------------------------------------------- /test/controller/bin/gdb-controller: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | JP4AGENT_LOC=../../.. 5 | 6 | gdb $JP4AGENT_LOC/test/controller/obj/controller 7 | -------------------------------------------------------------------------------- /test/controller/bin/run-controller: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../.. 4 | 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/obj 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/afi/obj 9 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/AFI 11 | 12 | $JP4AGENT_LOC/test/controller/obj/controller 13 | -------------------------------------------------------------------------------- /test/controller/include/P4InfoUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Utils.h 3 | // 4 | // Test controller 5 | // 6 | // Created by Sandesh Kumar Sodhi, December 2017 7 | // Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 8 | // 9 | // All rights reserved. 10 | // 11 | // Notice and Disclaimer: This code is licensed to you under the Apache 12 | // License 2.0 (the "License"). You may not use this code except in compliance 13 | // with the License. This code is not an official Juniper product. You can 14 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Third-Party Code: This code may depend on other components under separate 17 | // copyright notice and license terms. Your use of the source code for those 18 | // components is subject to the terms and conditions of the respective license 19 | // as noted in the Third-Party source code file. 20 | // 21 | 22 | #ifndef _UTILS_H_ 23 | #define _UTILS_H_ 24 | 25 | #ifdef UBUNTU 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | #include 32 | 33 | int get_table_id(const p4::config::P4Info &p4info, const std::string &t_name); 34 | 35 | int get_action_id(const p4::config::P4Info &p4info, const std::string &a_name); 36 | 37 | int get_mf_id(const p4::config::P4Info &p4info, 38 | const std::string &t_name, const std::string &mf_name); 39 | 40 | int get_param_id(const p4::config::P4Info &p4info, 41 | const std::string &a_name, const std::string ¶m_name); 42 | 43 | p4::config::P4Info parse_p4info(const char *path); 44 | 45 | #endif // _UTILS_H_ 46 | -------------------------------------------------------------------------------- /test/controller/src/Main.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Main.cpp 3 | // 4 | // Test controller 5 | // 6 | // Created by Sandesh Kumar Sodhi, December 2017 7 | // Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 8 | // 9 | // All rights reserved. 10 | // 11 | // Notice and Disclaimer: This code is licensed to you under the Apache 12 | // License 2.0 (the "License"). You may not use this code except in compliance 13 | // with the License. This code is not an official Juniper product. You can 14 | // obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Third-Party Code: This code may depend on other components under separate 17 | // copyright notice and license terms. Your use of the source code for those 18 | // components is subject to the terms and conditions of the respective license 19 | // as noted in the Third-Party source code file. 20 | // 21 | 22 | 23 | #include 24 | #include "Controller.h" 25 | 26 | using namespace std::chrono_literals; 27 | 28 | int main() 29 | { 30 | int status = ControllerSetConfig(); 31 | 32 | status = ControllerAddRouteEntry(0x0a000001, 16, 0x0a000001, 0x88a25e9175ff, 1); 33 | 34 | return status; 35 | } 36 | -------------------------------------------------------------------------------- /test/controller/testdata/afi_switch.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "afi-object" : "kpqfexIKEHBhY2tldC5pcDQuZGFkZHLq/aGPAgoKCGlwdjRfbHBtuqyoyAgCCAo=", 4 | "afi-object-id" : 101, 5 | "afi-object-name" : "ipv4_lpm", 6 | "afi-object-type" : "afi-tree" 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /test/controller/testdata/loopback.p4: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-present Barefoot Networks, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | parser start { 17 | return ingress; 18 | } 19 | 20 | action redirect() { 21 | modify_field(standard_metadata.egress_spec, standard_metadata.ingress_port); 22 | } 23 | 24 | table t_redirect { 25 | actions { redirect; } 26 | default_action: redirect(); 27 | } 28 | 29 | control ingress { 30 | apply(t_redirect); 31 | } 32 | 33 | control egress { } 34 | -------------------------------------------------------------------------------- /test/controller/testdata/loopback.proto.txt: -------------------------------------------------------------------------------- 1 | tables { 2 | preamble { 3 | id: 33591959 4 | name: "t_redirect" 5 | alias: "t_redirect" 6 | } 7 | action_refs { 8 | id: 16794474 9 | } 10 | size: 1024 11 | } 12 | actions { 13 | preamble { 14 | id: 16794474 15 | name: "redirect" 16 | alias: "redirect" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/controller/testdata/packet_io.p4: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-present Barefoot Networks, Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | #define CPU_PORT 64 17 | 18 | parser start { 19 | return ingress; 20 | } 21 | 22 | action redirect() { modify_field(standard_metadata.egress_spec, CPU_PORT); } 23 | 24 | table t_redirect { 25 | actions { redirect; } 26 | default_action: redirect(); 27 | } 28 | 29 | control ingress { 30 | apply(t_redirect); 31 | } 32 | 33 | control egress { } 34 | -------------------------------------------------------------------------------- /test/controller/testdata/packet_io.proto.txt: -------------------------------------------------------------------------------- 1 | tables { 2 | preamble { 3 | id: 33591959 4 | name: "t_redirect" 5 | alias: "t_redirect" 6 | } 7 | action_refs { 8 | id: 16794474 9 | } 10 | size: 1024 11 | } 12 | actions { 13 | preamble { 14 | id: 16794474 15 | name: "redirect" 16 | alias: "redirect" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/gtest/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled binary # 2 | ################### 3 | GTEST_RESULT_* 4 | jp4agent-gtest* 5 | -------------------------------------------------------------------------------- /test/gtest/README.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | Compilation 23 | =========== 24 | cd src 25 | make 26 | 27 | Running the example VMX client 28 | ============================== 29 | cd bin 30 | ./run-jp4agent-gtest 31 | 32 | Running the example Broadcom client 33 | =================================== 34 | cd bin 35 | ./run-jp4agent-gtest brcm 36 | -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/hostPing/ge-0.0.2-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/hostPing/ge-0.0.2-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/injectL2Pkt/ge-0.0.2-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/injectL2Pkt/ge-0.0.2-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/ipv4Router/ge-0.0.2-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/ipv4Router/ge-0.0.2-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/ipv4Router/ge-0.0.3-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/ipv4Router/ge-0.0.3-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/puntL2Pkt/ge-0.0.2-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/puntL2Pkt/ge-0.0.2-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/GTEST_EXPECTED/P4/sendArpReq/ge-0.0.2-vmx1.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Juniper/JP4Agent/c5773a901990df0a8cff7990a62fbc683449c231/test/gtest/bin/GTEST_EXPECTED/P4/sendArpReq/ge-0.0.2-vmx1.pcap -------------------------------------------------------------------------------- /test/gtest/bin/run-jp4agent-gtest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | JP4AGENT_LOC=../../.. 4 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 5 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/pi/protos 6 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/jp4agent/obj 7 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JP4AGENT_LOC/src/utils/obj 8 | 9 | if [ "$1" == "nullTest" ] 10 | then 11 | echo "Deleting file NullTest.txt\n" 12 | rm -f $JP4AGENT_LOC/src/targets/null/NullTest.txt 13 | $JP4AGENT_LOC/test/gtest/obj/jp4agent-gtest $1 14 | elif [ "$1" == "brcm" ] 15 | then 16 | $JP4AGENT_LOC/test/gtest/obj/jp4agent-gtest $1 --gtest_output=xml:./ 17 | elif [ "$1" == "brcmspine" ] 18 | then 19 | $JP4AGENT_LOC/test/gtest/obj/jp4agent-gtest $1 --gtest_output=xml:./ 20 | else 21 | $JP4AGENT_LOC/test/gtest/obj/jp4agent-gtest --gtest_output=xml:./ 22 | fi 23 | 24 | -------------------------------------------------------------------------------- /test/scripts/nullTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Run null gtest with Travis 4 | # 5 | # 6 | # Created by Manmeet Singh, February 2018 7 | # Copyright (c) [2018] Juniper Networks, Inc. All rights reserved. 8 | # 9 | # All rights reserved. 10 | # 11 | # Notice and Disclaimer: This code is licensed to you under the Apache 12 | # License 2.0 (the "License"). You may not use this code except in compliance 13 | # with the License. This code is not an official Juniper product. You can 14 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Third-Party Code: This code may depend on other components under separate 17 | # copyright notice and license terms. Your use of the source code for those 18 | # components is subject to the terms and conditions of the respective license 19 | # as noted in the Third-Party source code file. 20 | 21 | # Start JP4Agent 22 | cd /root/JP4Agent/src/targets/null/bin 23 | ./run-jp4agent & 24 | sleep 10 25 | 26 | # Execute Null Test 27 | cd /root/JP4Agent/test/gtest/bin 28 | ./run-jp4agent-gtest nullTest 29 | sleep 10 30 | 31 | # Shut down JP4Agent 32 | . ../../../tools/docker/scripts/shutdown_jp4agent.sh 33 | -------------------------------------------------------------------------------- /test/scripts/udp_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # udp_server.py: UDP server 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | 22 | import SocketServer 23 | #import hexdump 24 | PKTIO_IP = "172.18.0.20" 25 | PKTIO_PORT = 64014 26 | 27 | class UDPHandler(SocketServer.BaseRequestHandler): 28 | 29 | def handle(self): 30 | data = self.request[0].strip() 31 | socket = self.request[1] 32 | print "{} wrote:".format(self.client_address[0]) 33 | print data 34 | #hexdump.dump(data, sep=":") 35 | socket.sendto(data.upper(), (PKTIO_IP, PKTIO_PORT)) 36 | 37 | if __name__ == "__main__": 38 | HOST, PORT = "172.18.0.3", 64015 39 | print "Listening on " + str(HOST) + ":" + str(PORT) 40 | server = SocketServer.UDPServer((HOST, PORT), UDPHandler) 41 | server.serve_forever() 42 | 43 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | # log # 2 | ################### 3 | log 4 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | Tools for JP4Agent 2 | ============================= 3 | 4 | -------------------------------------------------------------------------------- /tools/config/cron.cfg: -------------------------------------------------------------------------------- 1 | */30 * * * * export JP4AGENT_REPO=/storage/sandesh/JP4Agent; export CPPLINT=/storage/sandesh/styleguide/cpplint/cpplint.py ;$JP4AGENT_REPO/tools/scripts/run-regression >> $JP4AGENT_REPO/tools/log/regression.log 2 | -------------------------------------------------------------------------------- /tools/config/vmx-cfg.xml: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 26 | /home/sandesh/VMX 27 | 28 | jnprp4vmx 29 | juniper/p4-vmx:latest 30 | 31 | 32 | root 33 | JunAFI 34 | 8601 35 | 36 | 37 | 38 | pfe 39 | pfe 40 | 8602 41 | 42 | 43 | eth0 44 | eth2 45 | eth3 46 | 47 | 48 | -------------------------------------------------------------------------------- /tools/docker/cfg/cron.cfg: -------------------------------------------------------------------------------- 1 | 0,30 * * * * /root/JP4Agent/tools/docker/scripts/clear_rior_zt.log.sh > /dev/null 2 | -------------------------------------------------------------------------------- /tools/docker/cfg/fwd_sandbox_junos_config.txt: -------------------------------------------------------------------------------- 1 | set forwarding-options forwarding-sandbox jp4agent port p1 interface xe-0/0/0:1 2 | set forwarding-options forwarding-sandbox jp4agent port p2 interface xe-0/0/0:2 3 | -------------------------------------------------------------------------------- /tools/docker/cfg/junos_config.txt: -------------------------------------------------------------------------------- 1 | delete groups re0 interfaces fxp0 2 | set groups re0 interfaces fxp0 unit 0 family inet address REPLACE_WITH_VCP_IP/16 3 | -------------------------------------------------------------------------------- /tools/docker/cfg/vmx-junosdev.conf: -------------------------------------------------------------------------------- 1 | ############################################################## 2 | # 3 | # vmx-junos-dev.conf 4 | # - Config file for junos device bindings. 5 | # - Uses YAML syntax. 6 | # - Leave a space after ":" to specify the parameter value. 7 | # - For physical NIC, set the 'type' as 'host_dev' 8 | # - For junos devices, set the 'type' as 'junos_dev' and 9 | # set the mandatory parameter 'vm-name' to the name of 10 | # the vPFE where the device exists 11 | # - For bridge devices, set the 'type' as 'bridge_dev' 12 | # 13 | ############################################################## 14 | interfaces : 15 | 16 | - link_name : vmx_link10 17 | mtu : 1500 18 | endpoint_1 : 19 | - type : junos_dev 20 | vm_name : vmx1 21 | dev_name : ge-0/0/0 22 | endpoint_2 : 23 | - type : host_dev 24 | dev_name : tap0 25 | 26 | - link_name : vmx_link11 27 | mtu : 1500 28 | endpoint_1 : 29 | - type : junos_dev 30 | vm_name : vmx1 31 | dev_name : ge-0/0/1 32 | endpoint_2 : 33 | - type : host_dev 34 | dev_name : tap1 35 | 36 | - link_name : vmx_link12 37 | mtu : 1500 38 | endpoint_1 : 39 | - type : junos_dev 40 | vm_name : vmx1 41 | dev_name : ge-0/0/2 42 | endpoint_2 : 43 | - type : host_dev 44 | dev_name : REPLACE_WITH_IF1 45 | 46 | - link_name : vmx_link13 47 | mtu : 1500 48 | endpoint_1 : 49 | - type : junos_dev 50 | vm_name : vmx1 51 | dev_name : ge-0/0/3 52 | endpoint_2 : 53 | - type : host_dev 54 | dev_name : REPLACE_WITH_IF2 55 | 56 | -------------------------------------------------------------------------------- /tools/docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 4 | echo 5 | echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 | echo Welcome to Juniper P4 Docker Container 7 | echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 | echo 9 | echo 10 | 11 | /bin/bash 12 | -------------------------------------------------------------------------------- /tools/docker/env/bash_aliases: -------------------------------------------------------------------------------- 1 | 2 | 3 | # To prevent accidents 4 | alias rm='rm -i' 5 | alias mv='mv -i' 6 | alias cp='cp -i' 7 | -------------------------------------------------------------------------------- /tools/docker/env/tmux.conf: -------------------------------------------------------------------------------- 1 | unbind C-b 2 | set -g prefix C-a 3 | 4 | set -g history-limit 10000000 5 | 6 | 7 | bind-key | split-window -h 8 | bind-key - split-window 9 | 10 | setw -g mode-keys vi 11 | setw -g window-status-current-attr underscore 12 | 13 | unbind [ 14 | bind Escape copy-mode 15 | unbind p 16 | bind p paste-buffer 17 | bind-key -t vi-copy 'v' begin-selection 18 | bind-key -t vi-copy 'y' copy-selection 19 | bind-key C-a last-window 20 | bind-key Space next-window 21 | bind-key BSpace previous-window 22 | -------------------------------------------------------------------------------- /tools/docker/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | exp_internal.log.txt 2 | -------------------------------------------------------------------------------- /tools/docker/scripts/build-jp4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # JP4Agent build script 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | cd /root/JP4Agent/AFI/ ; make 22 | cd /root/JP4Agent/src/ ; make -j4 23 | cd /root/JP4Agent/test/controller/ ; make 24 | cd /root/JP4Agent/test/gtest/ ; make 25 | 26 | # 27 | # Regression script 'docker_run_ut.expect' use this message to detect compilation status. 28 | # If you change this message, please make the same change in 'docker_run_ut.expect'. 29 | # 30 | echo "JP4Agent binaries compilation success!!" 31 | exit 0 32 | -------------------------------------------------------------------------------- /tools/docker/scripts/clear_rior_zt.log.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect 2 | # 3 | # VMX setup scripts 4 | # 5 | # Created by Sandesh Kumar Sodhi, January 2018 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | source [file join [file dirname [info script]] lib.exp] 22 | # 23 | # Disable inline ICMP 24 | # 25 | log_debug "Will connect to VFP via ssh and clear /var/log/riot_zt.log file" 26 | set script_name [file tail $argv0] 27 | 28 | proc display_usage {} { 29 | global script_name 30 | puts "Usage : $script_name" 31 | return 1 32 | } 33 | 34 | set spawn_id [login_vfp_ssh] 35 | 36 | # 37 | # timeout 30 seconds 38 | # 39 | set timeout 30 40 | 41 | expect "$vfp_prompt" { send "ls -lh /var/log/riot_zt.log\r" } 42 | expect "$vfp_prompt" { send "> /var/log/riot_zt.log\r" } 43 | expect "$vfp_prompt" { send "ls -lh /var/log/riot_zt.log\r" } 44 | expect "$vfp_prompt" { send "\r" } 45 | send "exit\r" 46 | 47 | close 48 | exit 0 49 | -------------------------------------------------------------------------------- /tools/docker/scripts/config_br-int-vmx1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # VMX setup scripts 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | COMMAND="ifconfig br-int-vmx1 128.0.0.100 netmask 255.255.0.0 up" 22 | echo $COMMAND 23 | $COMMAND 24 | 25 | ifconfig br-int-vmx1 26 | 27 | exit 0 28 | -------------------------------------------------------------------------------- /tools/docker/scripts/config_vfp_ext_if.exp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect 2 | # 3 | # VMX setup scripts 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | source /root/JP4Agent/tools/docker/scripts/lib.exp 22 | 23 | # 24 | # Disable flow cache 25 | # 26 | log_debug "Will connect to VFP console and disable flow cache" 27 | 28 | set script_name [file tail $argv0] 29 | 30 | proc display_usage {} { 31 | global script_name 32 | puts "Usage : $script_name" 33 | return 1 34 | } 35 | 36 | set spawn_id [login_vfp_console] 37 | 38 | # 39 | # timeout 60 seconds 40 | # 41 | set timeout 60 42 | 43 | expect "$vfp_prompt" { send "\r" } 44 | expect "$vfp_prompt" { send "ifconfig ext REPLACE_WITH_VFP_IP netmask 255.255.0.0 up\r" } 45 | 46 | send "exit\r" 47 | 48 | close 49 | exit 0 50 | -------------------------------------------------------------------------------- /tools/docker/scripts/shutdown_jp4agent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # JP4Agent build script 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | ps -ef | grep "jp4agent" | awk '{print $2}' | xargs kill -SIGUSR1 22 | # 23 | # Regression script 'docker_run_ut.expect' use this message to detect compilation status. 24 | # If you change this message, please make the same change in 'docker_run_ut.expect'. 25 | # 26 | echo "Sent SIGUSR1 signal to JP4Agent!" 27 | exit 0 28 | -------------------------------------------------------------------------------- /tools/docker/scripts/stop_vmx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # VMX setup scripts 4 | # 5 | # Created by Sandesh Kumar Sodhi, December 2017 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | MY_DIR="$(dirname "$0")" 22 | source "$MY_DIR/cmn.sh" 23 | 24 | me=`basename "$0"` 25 | 26 | # 27 | # Stop VMX 28 | # 29 | cd $VMX_DIR 30 | ./vmx.sh --stop 31 | ./vmx.sh --cleanup 32 | ./vmx.sh --unbind-dev 33 | 34 | log_debug "Before bridge cleanup" 35 | brctl show 36 | ip link set br-int-vmx1 down 37 | brctl delbr br-int-vmx1 38 | 39 | 40 | $VIRSH net-undefine br-ext 41 | $VIRSH net-undefine br-int-vmx1 42 | 43 | $BRCTL delbr br-ext 44 | 45 | log_debug "After bridge cleanup" 46 | brctl show 47 | exit 0 48 | -------------------------------------------------------------------------------- /tools/report/.gitignore: -------------------------------------------------------------------------------- 1 | # regression report # 2 | ################### 3 | regression.xml 4 | regress_* 5 | vmxsetup_* 6 | 7 | -------------------------------------------------------------------------------- /tools/report/gtest-not-run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tools/report/gtest-result.dtd: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tools/report/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | JP4Agent Regression 4 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |   https://github.com/Juniper/JP4Agent
21 | 
22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /tools/scripts/delete_old_reports.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Regression scripts 4 | # 5 | # Delete old reports 6 | # 7 | # Created by Sandesh Kumar Sodhi, January 2018 8 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 9 | # 10 | # All rights reserved. 11 | # 12 | # Notice and Disclaimer: This code is licensed to you under the Apache 13 | # License 2.0 (the "License"). You may not use this code except in compliance 14 | # with the License. This code is not an official Juniper product. You can 15 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Third-Party Code: This code may depend on other components under separate 18 | # copyright notice and license terms. Your use of the source code for those 19 | # components is subject to the terms and conditions of the respective license 20 | # as noted in the Third-Party source code file. 21 | # 22 | 23 | 24 | MY_DIR="$(dirname "$0")" 25 | source "$MY_DIR/cmn.sh" 26 | 27 | report_dirs=`ls -1t $REPORT_DIR | grep $INDIVIDUAL_REGRESSION_REPORT_DIR_NAME_PREFIX` 28 | 29 | echo "Deleting old reports...(will preserve last $NUM_LAST_REPORTS_TO_PRESERVE reports)" 30 | 31 | COUNTER=0 32 | COUNTER_NUM_PRESERVED=0 33 | COUNTER_NUM_DELETED=0 34 | for dir in $report_dirs; 35 | do 36 | let COUNTER+=1 37 | #echo $COUNTER : $d 38 | if [ $COUNTER -gt $NUM_LAST_REPORTS_TO_PRESERVE ]; then 39 | echo "Deleting $COUNTER : $REPORT_DIR/$dir" 40 | rm -rf $REPORT_DIR/$dir 41 | let COUNTER_NUM_DELETED+=1 42 | else 43 | #echo "Will preserve $COUNTER : $dir" 44 | let COUNTER_NUM_PRESERVED+=1 45 | fi 46 | done 47 | 48 | echo "Deleted $COUNTER_NUM_DELETED reports (preserved last $COUNTER_NUM_PRESERVED reports)" 49 | 50 | exit 0 51 | -------------------------------------------------------------------------------- /tools/scripts/http_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Regression scripts 4 | # 5 | # http_server.py : Python script to start http server 6 | # 7 | # Created by Sandesh Kumar Sodhi, January 2018 8 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 9 | # 10 | # All rights reserved. 11 | # 12 | # Notice and Disclaimer: This code is licensed to you under the Apache 13 | # License 2.0 (the "License"). You may not use this code except in compliance 14 | # with the License. This code is not an official Juniper product. You can 15 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Third-Party Code: This code may depend on other components under separate 18 | # copyright notice and license terms. Your use of the source code for those 19 | # components is subject to the terms and conditions of the respective license 20 | # as noted in the Third-Party source code file. 21 | # 22 | 23 | import sys 24 | import BaseHTTPServer 25 | import CGIHTTPServer 26 | import cgitb; cgitb.enable() ## This line enables CGI error reporting 27 | 28 | http_server_port = sys.argv[1] 29 | 30 | server = BaseHTTPServer.HTTPServer 31 | handler = CGIHTTPServer.CGIHTTPRequestHandler 32 | server_address = ("", int(http_server_port)) 33 | handler.cgi_directories = ["/cgi-bin"] 34 | 35 | httpd = server(server_address, handler) 36 | httpd.serve_forever() 37 | -------------------------------------------------------------------------------- /tools/scripts/install_packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Install required packages on host 4 | # 5 | # Created by Sandesh Kumar Sodhi, January 2018 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | apt-get update 22 | apt-get install -y --no-install-recommends expect tdom libxml2-utils realpath 23 | exit 0 24 | -------------------------------------------------------------------------------- /tools/scripts/schedule_cron_job.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Schedule cron jobs 4 | # 5 | # Created by Sandesh Kumar Sodhi, January 2018 6 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 7 | # 8 | # All rights reserved. 9 | # 10 | # Notice and Disclaimer: This code is licensed to you under the Apache 11 | # License 2.0 (the "License"). You may not use this code except in compliance 12 | # with the License. This code is not an official Juniper product. You can 13 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Third-Party Code: This code may depend on other components under separate 16 | # copyright notice and license terms. Your use of the source code for those 17 | # components is subject to the terms and conditions of the respective license 18 | # as noted in the Third-Party source code file. 19 | # 20 | 21 | 22 | MY_DIR="$(dirname "$0")" 23 | source "$MY_DIR/cmn.sh" 24 | 25 | me=`basename "$0"` 26 | 27 | log_debug "______ Current cron jobs (These will be delete)_____" 28 | crontab -l 29 | crontab $REPO_DIR/tools/config/cron.cfg 30 | log_debug "______ New cron jobs__________" 31 | crontab -l 32 | -------------------------------------------------------------------------------- /tools/scripts/start-http-server: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Regression scripts 4 | # 5 | # start-http-server : Starts http server 6 | # 7 | # Created by Sandesh Kumar Sodhi, January 2018 8 | # Copyright (c) [2017] Juniper Networks, Inc. All rights reserved. 9 | # 10 | # All rights reserved. 11 | # 12 | # Notice and Disclaimer: This code is licensed to you under the Apache 13 | # License 2.0 (the "License"). You may not use this code except in compliance 14 | # with the License. This code is not an official Juniper product. You can 15 | # obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 16 | # 17 | # Third-Party Code: This code may depend on other components under separate 18 | # copyright notice and license terms. Your use of the source code for those 19 | # components is subject to the terms and conditions of the respective license 20 | # as noted in the Third-Party source code file. 21 | # 22 | 23 | MY_DIR="$(dirname "$0")" 24 | source "$MY_DIR/cmn.sh" 25 | 26 | HTTP_SERVER_PORT=$(xmllint --xpath "//regressionConfig/regressionReportHTTPServerPort/text()" $REGRESSION_CONFIG_FILE) 27 | 28 | is_running=`ps awxu | grep python | grep http_server.py | grep $HTTP_SERVER_PORT | wc -l`; 29 | 30 | if [ $is_running -eq 1 ]; then 31 | log_debug "Python http server is running. Will restart it" 32 | fi 33 | 34 | pkill http_server.py 35 | sleep 2 36 | log_debug "Starting http server (port $HTTP_SERVER_PORT)..." 37 | cd $REGRESSION_REPORT_DIR 38 | $REGRESSION_SCRIPTS_DIR/http_server.py $HTTP_SERVER_PORT >> $REGRESSION_LOG_DIR/http_server.py.log 2>&1 < /dev/null & 39 | 40 | exit 0 41 | --------------------------------------------------------------------------------