Skip to content

Commit

Permalink
EosSdk Enhancements/BugFixes for EosSdk-2.22.0 (EOS 4.26.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Rufer committed Aug 6, 2022
1 parent 4bbd379 commit 434d2e5
Show file tree
Hide file tree
Showing 110 changed files with 7,113 additions and 7,694 deletions.
4 changes: 4 additions & 0 deletions EosSdk.i
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ typedef uint64_t uint64_be_t;
%feature("nodirector") eos::system_mgr;
%feature("nodirector") eos::timeout_mgr;
%feature("nodirector") eos::vrf_mgr;
%feature("nodirector") eos::xcvr_mgr;

%{
#include "eos/acl.h"
Expand Down Expand Up @@ -146,6 +147,7 @@ typedef uint64_t uint64_be_t;
#include "eos/utility.h"
#include "eos/version.h"
#include "eos/vrf.h"
#include "eos/xcvr.h"

using namespace eos;

Expand Down Expand Up @@ -277,6 +279,8 @@ void throw_py_error(error const& err) {
// Python code should use Python exceptions, and not call panic().
%ignore panic;
%ignore vpanic;
%ignore modbit;
%ignore invalid_mpls_label;
%include "Includes.i"


Expand Down
2 changes: 1 addition & 1 deletion GetAgentProcessName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ std::string get_agent_process_name(void) {
std::string arg0 = line.substr(0, arg_break);
// Strip off the path
program_name = arg0.substr(arg0.find_last_of('/') + 1);
if(program_name == "python") {
if (program_name.find("python") != std::string::npos) {
// Running a python agent (i.e. 'python xxx.py' or '/usr/bin/python xxx.py')
arg0 = line.substr(arg_break + 1, line.find_first_of('\0', arg_break + 1));
program_name = arg0.substr(arg0.find_last_of('/') + 1);
Expand Down
2 changes: 2 additions & 0 deletions GoEosSdk.i
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef uint64_t uint64_be_t;
%feature("nodirector") eos::system_mgr;
%feature("nodirector") eos::timeout_mgr;
%feature("nodirector") eos::vrf_mgr;
%feature("nodirector") eos::xcvr_mgr;

%{
//#include "eos/acl.h"
Expand Down Expand Up @@ -154,6 +155,7 @@ typedef uint64_t uint64_be_t;
#include "eos/utility.h"
#include "eos/version.h"
#include "eos/vrf.h"
#include "eos/xcvr.h"

using namespace std;
using namespace eos;
Expand Down
160 changes: 160 additions & 0 deletions Includes.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
// This file was generated by GenSwigIncludeList.py
%include "eos/types/eth_intf.h"
%include "eos/types/mlag.h"
%include "eos/utility.h"
%include "eos/types/eapi.h"
%include "eos/base.h"
%include "eos/types/sdk.h"
%include "eos/exception.h"
%include "eos/hash_mix.h"
%include "eos/types/eth.h"
%include "eos/panic.h"
%include "eos/types/ip.h"
%include "eos/types/acl.h"
%include "eos/types/intf.h"
%include "eos/types/bfd.h"
%include "eos/types/eth_phy_intf.h"
%include "eos/types/fpga.h"
%include "eos/types/ham.h"
%include "eos/types/hardware_table.h"
%include "eos/types/lldp.h"
%include "eos/types/macsec.h"
%include "eos/types/mpls.h"
%include "eos/types/mpls_vrf_label.h"
%include "eos/types/nexthop_group.h"
%include "eos/types/vrf.h"
%include "eos/types/subintf.h"
%include "eos/ip.h"
%include "eos/types/aresolve.h"
%include "eos/types/bgp.h"
%include "eos/types/bgp_path.h"
%include "eos/types/decap_group.h"
%include "eos/eth.h"
%include "eos/intf.h"
%include "eos/types/directflow.h"
%include "eos/types/eth_lag_intf.h"
%include "eos/mpls.h"
%include "eos/types/ip_route.h"
%include "eos/types/l1_source.h"
%include "eos/types/mac_table.h"
%include "eos/types/mpls_route.h"
%include "eos/types/neighbor_table.h"
%include "eos/types/nexthop_group_tunnel.h"
%include "eos/acl.h"
%include "eos/types/policy_map.h"
%include "eos/ip_route.h"
%include "eos/types/fib.h"
%include "eos/bgp.h"
%include "eos/types/route_map.h"
%include "eos/policy_map.h"
%include "eos/types/class_map.h"
%include "eos/base_handler.h"
%include "eos/base_mgr.h"
%include "eos/event_loop.h"
%include "eos/fd.h"
%include "eos/inline/types/eth_intf.h"
%include "eos/inline/types/mlag.h"
%include "eos/inline/utility.h"
%include "eos/iterator.h"
%include "eos/tracing.h"
%include "eos/version.h"
%include "eos/agent.h"
%include "eos/eapi.h"
%include "eos/inline/event_loop.h"
%include "eos/inline/exception.h"
%include "eos/inline/hash_mix.h"
%include "eos/inline/iterator.h"
%include "eos/inline/types/eapi.h"
%include "eos/inline/types/sdk.h"
%include "eos/timer.h"
%include "eos/fpga.h"
%include "eos/ham.h"
%include "eos/hardware_table.h"
%include "eos/inline/agent.h"
%include "eos/inline/types/acl.h"
%include "eos/inline/types/bfd.h"
%include "eos/inline/types/eth.h"
%include "eos/inline/types/eth_phy_intf.h"
%include "eos/inline/types/fpga.h"
%include "eos/inline/types/ham.h"
%include "eos/inline/types/hardware_table.h"
%include "eos/inline/types/intf.h"
%include "eos/inline/types/ip.h"
%include "eos/inline/types/lldp.h"
%include "eos/inline/types/macsec.h"
%include "eos/inline/types/mpls.h"
%include "eos/inline/types/mpls_vrf_label.h"
%include "eos/inline/types/nexthop_group.h"
%include "eos/inline/types/vrf.h"
%include "eos/sdk.h"
%include "eos/vrf.h"
%include "eos/xcvr.h"
%include "eos/bfd.h"
%include "eos/eth_intf.h"
%include "eos/eth_phy_intf.h"
%include "eos/inline/fpga.h"
%include "eos/inline/ham.h"
%include "eos/inline/hardware_table.h"
%include "eos/inline/intf.h"
%include "eos/inline/sdk.h"
%include "eos/inline/types/subintf.h"
%include "eos/inline/vrf.h"
%include "eos/ip_intf.h"
%include "eos/lldp.h"
%include "eos/macsec.h"
%include "eos/mlag.h"
%include "eos/nexthop_group.h"
%include "eos/subintf.h"
%include "eos/system.h"
%include "eos/aresolve.h"
%include "eos/bgp_path.h"
%include "eos/decap_group.h"
%include "eos/directflow.h"
%include "eos/eth_lag_intf.h"
%include "eos/inline/acl.h"
%include "eos/inline/bfd.h"
%include "eos/inline/eth_intf.h"
%include "eos/inline/eth_phy_intf.h"
%include "eos/inline/ip_intf.h"
%include "eos/inline/lldp.h"
%include "eos/inline/macsec.h"
%include "eos/inline/mlag.h"
%include "eos/inline/nexthop_group.h"
%include "eos/inline/system.h"
%include "eos/inline/types/aresolve.h"
%include "eos/inline/types/bgp.h"
%include "eos/inline/types/bgp_path.h"
%include "eos/inline/types/decap_group.h"
%include "eos/inline/types/directflow.h"
%include "eos/inline/types/eth_lag_intf.h"
%include "eos/inline/types/ip_route.h"
%include "eos/inline/types/l1_source.h"
%include "eos/inline/types/mac_table.h"
%include "eos/inline/types/mpls_route.h"
%include "eos/inline/types/neighbor_table.h"
%include "eos/inline/types/nexthop_group_tunnel.h"
%include "eos/l1_source.h"
%include "eos/mac_table.h"
%include "eos/mpls_route.h"
%include "eos/mpls_vrf_label.h"
%include "eos/neighbor_table.h"
%include "eos/nexthop_group_tunnel.h"
%include "eos/inline/aresolve.h"
%include "eos/inline/bgp.h"
%include "eos/inline/bgp_path.h"
%include "eos/inline/directflow.h"
%include "eos/inline/eth_lag_intf.h"
%include "eos/inline/l1_source.h"
%include "eos/inline/mac_table.h"
%include "eos/inline/mpls_route.h"
%include "eos/inline/neighbor_table.h"
%include "eos/inline/nexthop_group_tunnel.h"
%include "eos/inline/types/policy_map.h"
%include "eos/fib.h"
%include "eos/inline/policy_map.h"
%include "eos/inline/types/fib.h"
%include "eos/inline/types/route_map.h"
%include "eos/route_map.h"
%include "eos/class_map.h"
%include "eos/inline/fib.h"
%include "eos/inline/types/class_map.h"
5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib_LTLIBRARIES = libeos.la
lib_LTLIBRARIES = libeos.la libeosgopenflow.la

AM_CXXFLAGS = -fvisibility=hidden
AM_CXXFLAGS += -Wextra -Wall -Wnon-virtual-dtor -Werror -Wno-unused-parameter -Wno-error=unused-value
Expand Down Expand Up @@ -75,12 +75,15 @@ libeos_la_SOURCES += bfd.cpp
libeos_la_SOURCES += bgp.cpp
libeos_la_SOURCES += bgp_path.cpp
libeos_la_SOURCES += lldp.cpp
libeos_la_SOURCES += xcvr.cpp
libeos_la_SOURCES += nexthop_group_tunnel.cpp

libeos_la_CPPFLAGS = $(AM_CPPFLAGS) $(SHIPPING_FLAG)
libeos_la_LDFLAGS = -version-info $(SDK_LIBTOOL_VERSION) -lrt
libeos_la_LDFLAGS += -soname libeos.so.$(SDK_VERSION_MAJOR).$(SDK_VERSION_MINOR)

libeosgopenflow_la_SOURCES = gopenflow.cpp
libeosgopenflow_la_LDFLAGS = -version-info $(SDK_LIBTOOL_VERSION)

noinst_PROGRAMS = HelloWorld
HelloWorld_SOURCES = examples/HelloWorld.cpp
Expand Down
2 changes: 1 addition & 1 deletion MaybePrintProfilesAndExit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void print_profiles::add_profile(const char * profile) {
// have been instantiated, so print the collected profiles and exit.
void print_profiles::write_profiles() {
if (print_profiles_fp) {
fprintf(print_profiles_fp,
fprintf(print_profiles_fp,
"# This file is deprecated, i.e., mount profile is not necessary anymore.\n"
"# Please stop generating it.\n" );
fclose(print_profiles_fp);
Expand Down
14 changes: 8 additions & 6 deletions SdkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ namespace eos {
subintf_mgr_(0), \
system_mgr_(0), \
timeout_mgr_(0), \
vrf_mgr_(0) \
vrf_mgr_(0), \
xcvr_mgr_(0) \

// this is code we share with the stubs, used to figure out the name of the agent
// based on /proc/self/cmdline (at that point we no longer have access to argv), and
Expand All @@ -71,7 +72,7 @@ sdk::SdkImpl::SdkImpl() : SDK_INITIALIZATION_LIST {
print_profiles::set_print_profiles(name_.c_str());
}

sdk::SdkImpl::SdkImpl(std::string const name, void *eossdk_context)
sdk::SdkImpl::SdkImpl(std::string const name, void *eossdk_context)
: SDK_INITIALIZATION_LIST {
name_ = name;
eossdk_context_ = eossdk_context;
Expand Down Expand Up @@ -134,6 +135,7 @@ INIT_STUB_MGR(subintf_mgr)
INIT_STUB_MGR(system_mgr)
INIT_STUB_MGR(timeout_mgr)
INIT_STUB_MGR(vrf_mgr)
INIT_STUB_MGR(xcvr_mgr)

void sdk::SdkImpl::init_event_loop() {
if(!event_loop_) {
Expand Down Expand Up @@ -169,10 +171,10 @@ void param_trace_enable_is(bool new_param_trace) {
void api_trace_buffer_sizes_is(int(&size_spec)[10]) {
}

// Real functions to facilitate the making of customized sysdb-mount-profiles
// (to use in place of the brute-force one called "EosSdk", see
// /usr/lib/SysdbMountProfiles/EosSdkAll), an app can be started with the env var
// EOS_PRINT_PROFILES_AND_EXIT pointing to a filename where the profile should be
// Real functions to facilitate the making of customized sysdb-mount-profiles
// (to use in place of the brute-force one called "EosSdk", see
// /usr/lib/SysdbMountProfiles/EosSdkAll), an app can be started with the env var
// EOS_PRINT_PROFILES_AND_EXIT pointing to a filename where the profile should be
// written, then exit.
#include "MaybePrintProfilesAndExit.cpp"

Expand Down
6 changes: 3 additions & 3 deletions SwigUtils.i
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ STD_FORWARD_LIST(mpls_label_t)
PyErr_SetString(PyExc_TypeError, "argument must be a dictionary");
return NULL;
}
std::map<eos::policy_map_hw_status_key_t, policy_map_status_t> *a =
std::map<eos::policy_map_hw_status_key_t, policy_map_status_t> *a =
new std::map<eos::policy_map_hw_status_key_t, eos::policy_map_status_t>();
// Get hw status key and value
Py_ssize_t pos = 0;
PyObject *k;
PyObject *v;
while(PyDict_Next(t, &pos, &k, &v)) {
while(PyDict_Next(t, &pos, &k, &v)) {
eos::policy_map_hw_status_key_t *k_c;
if (SWIG_ConvertPtr(k, (void **)&k_c,
SWIGTYPE_p_eos__policy_map_hw_status_key_t,
Expand Down Expand Up @@ -159,7 +159,7 @@ STD_FORWARD_LIST(mpls_label_t)
for (it=a->cbegin(); it!=a->cend(); ++it) {
PyObject *status_key = SWIG_NewPointerObj((void*)&(it->first),
SWIGTYPE_p_eos__policy_map_hw_status_key_t, 0);
PyObject *st = PyInt_FromLong(it->second);
PyObject *st = PyInt_FromLong(it->second);
PyDict_SetItem(t, status_key, st);
}
$result = t;
Expand Down
2 changes: 1 addition & 1 deletion aresolve_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014 Arista Networks, Inc. All rights reserved.
// Copyright (c) 2016 Arista Networks, Inc. All rights reserved.
// Arista Networks, Inc. Confidential and Proprietary.

#include "eos/aresolve.h"
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CFLAGS_32B='-m32 -march=i686 -mtune=atom'
export CFLAGS
CXXFLAGS=$CFLAGS
export CXXFLAGS
CXXFLAGS_32B="-m32"
LDFLAGS_32B="-m32"
CXXFLAGS_32B="-m32"
LDFLAGS_32B="-m32"
export LDFLAGS

target_32b=true
Expand Down Expand Up @@ -61,9 +61,9 @@ test -f Makefile || ./configure \
set -x
STUBS_DIR=$PWD
GO_SRCDIR="$STUBS_DIR/go/src/eossdk"
mkdir -p "$GO_SRCDIR"
if [ -d $GO_SRCDIR/eos ]; then
rm -f "$GO_SRCDIR/eos"
ln -s "$STUBS_DIR/eos" "$GO_SRCDIR/"
fi

exec make "$@"
2 changes: 1 addition & 1 deletion directflow_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2014 Arista Networks, Inc. All rights reserved.
// Copyright (c) 2016 Arista Networks, Inc. All rights reserved.
// Arista Networks, Inc. Confidential and Proprietary.

#include "eos/directflow.h"
Expand Down
6 changes: 3 additions & 3 deletions eos/bgp.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class EOS_SDK_PUBLIC bgp_peer_handler : public base_handler<bgp_mgr,
explicit bgp_peer_handler(bgp_mgr *mgr);
bgp_mgr * get_bgp_mgr() const;


/// Register to receive notifications when any peer changes state.
void watch_all_peers(bool);

/// Register to receive notifications when the specified peer changes state.
void watch_peer(bgp_peer_key_t const & peer_key, bool);

Expand All @@ -68,7 +68,7 @@ class EOS_SDK_PUBLIC bgp_mgr : public base_mgr<bgp_peer_handler, bgp_peer_key_t>
* Test for existence of a BGP peer.
*/
virtual bool exists(bgp_peer_key_t const & peer_key) const = 0;

/**
* Returns the state of a peer session.
*
Expand Down
2 changes: 1 addition & 1 deletion eos/bgp_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class EOS_SDK_PUBLIC bgp_path_iter_t
* The BGP path handler.
*
* This class provides handler APIs to react to BGP path changes in Adj-RIB-In.
* New path updates are notified once BGP has converged.
* New path updates are notified once BGP has converged.
* An iterator must be used to retreive the existing paths after BGP convergence.
* This is only supported under multi-agent mode.
*
Expand Down
1 change: 1 addition & 0 deletions eos/fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class EOS_SDK_PUBLIC fib_mgr : public base_mgr<fib_handler> {
virtual void set_route6init_task(int const ) = 0;
virtual void set_fecinit_task(int const) = 0;
virtual void set_fec6init_task(int const) = 0;
virtual void set_fecGeninit_task(int const) = 0;

// Iterators
virtual fib_route_iter_t fib_route_iter() const = 0;
Expand Down
1 change: 1 addition & 0 deletions eos/fpga.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ class EOS_SDK_PUBLIC fpga_mgr : public base_mgr<fpga_handler, fpga_t> {
#include <eos/inline/fpga.h>

#endif // EOS_FPGA_H

1 change: 1 addition & 0 deletions eos/inline/bgp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ inline bgp_mgr * bgp_peer_handler::get_bgp_mgr() const {
} // end namespace eos

#endif // INLINE_BGP_H

1 change: 1 addition & 0 deletions eos/inline/bgp_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ inline bgp_path_mgr * bgp_path_handler::get_bgp_path_mgr() const {
} // end namespace eos

#endif // INLINE_BGP_PATH_H

Loading

0 comments on commit 434d2e5

Please sign in to comment.