Skip to content

Commit

Permalink
EOS SDK v2.22.1.4 (EOS 4.28.1F)
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Rufer committed Aug 10, 2022
1 parent dca53e6 commit d7cb9c8
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 10 deletions.
10 changes: 10 additions & 0 deletions EosSdk.i
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ except ImportError:
pass
%}

%include "cpointer.i"
%include "stdint.i"
%include "std_list.i"
%include "std_map.i"
Expand Down Expand Up @@ -98,6 +99,11 @@ typedef uint64_t uint64_be_t;
%feature("nodirector") eos::vrf_mgr;
%feature("nodirector") eos::xcvr_mgr;

// Do not generate Python bindings for the old programmed callback in the extended
// nexthop group handler class
%feature("nodirector") eos::nexthop_group_handler_v2::on_nexthop_group_programmed(
std::string const &);

%{
#include "eos/acl.h"
#include "eos/agent.h"
Expand Down Expand Up @@ -290,6 +296,10 @@ void throw_py_error(error const& err) {
}
};

// This is required to get the version ID when calling nexthop_group_set as it is
// returned in a uint16_t pointer.
%pointer_functions(uint16_t, uint16_t_p);

// Pythonify our iterators.
wrap_iterator(eos::acl_iter_t, eos::acl_iter_impl, eos::acl_key_t);
wrap_iterator(eos::acl_rule_ip_iter_t, eos::acl_rule_ip_iter_impl, eos::acl_rule_ip_entry_t);
Expand Down
4 changes: 2 additions & 2 deletions eos/base_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class EOS_SDK_PRIVATE base_mgr { // that don't use key-specific notificat

virtual void add_handler(T *handler) {
// no specific ordering
watchAllHandlers_.insert(std::make_pair(handler, true));
watchAllHandlers_[handler] = true;

// The handler is now registered in the "watchAll" set. The key-specific
// registration needs to be cleaned to avoid calling the handler twice.
Expand All @@ -79,7 +79,7 @@ class EOS_SDK_PRIVATE base_mgr { // that don't use key-specific notificat
return;
}
}
keySpecificHandlers_[key].insert(std::make_pair(handler, true));
keySpecificHandlers_[key][handler] = true;
}

virtual void remove_handler(T *handler) {
Expand Down
27 changes: 27 additions & 0 deletions eos/nexthop_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,29 @@ class EOS_SDK_PUBLIC nexthop_group_handler :
virtual void on_nexthop_group_programmed(std::string const & nexthop_group_name);
};

/**
* This class handles changes to a nexthop group's status and provides its version
* ID in the programmed callback.
*/
class EOS_SDK_PUBLIC nexthop_group_handler_v2 : public nexthop_group_handler {
public:
explicit nexthop_group_handler_v2(nexthop_group_mgr *);

/**
* Do not override this function. Instead override the alternative programmed
* handler.
*/
virtual void on_nexthop_group_programmed(std::string const & nexthop_group_name)
override final {}

/**
* Alternative handler called when a nexthop group is programmed in response to
* a configuration change. Provides the nexthop group's version ID.
*/
virtual void on_nexthop_group_programmed(std::string const & nexthop_group_name,
uint16_t version_id);
};

class nexthop_group_iter_impl;

// An iterator that yields nexthop group for each configured nexthop group
Expand Down Expand Up @@ -196,6 +219,10 @@ class EOS_SDK_PUBLIC nexthop_group_mgr :
friend class nexthop_group_handler;
private:
EOS_SDK_DISALLOW_COPY_CTOR(nexthop_group_mgr);
public:
// Creates or updates a nexthop group and provides its version ID.
virtual void nexthop_group_set(nexthop_group_t const & group,
uint16_t * version_id) = 0;
};

} // end namespace eos
Expand Down
27 changes: 21 additions & 6 deletions eos/policy_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,29 @@ class EOS_SDK_PUBLIC policy_map_handler : public base_handler<policy_map_mgr,
policy_map_mgr * get_policy_map_mgr() const;

/**
* Registers to receive updates on changes to this policy feature.
* Registers to receive updates on changes to all policy maps.
*
* @param key The policy feature to receive notifications for
* @param interest Receives notifications if and only if true.
*/
void watch_all_policy_maps(bool interest);

/**
* Registers to receive updates on changes to the specified policy map.
*
* @param key The key identifying the policy map to receive notifications for.
* @param interest Receives notifications if and only if true.
*/
void watch_policy_map(policy_map_key_t const & key, bool interest);

/**
* Registers to receive updates on changes to this policy feature.
* Registers to receive updates on changes to the specified policy map.
*
* @deprecated Please use watch_policy_map(policy_map_key_t const & key,
* bool interest) instead.
*
* @param key The policy feature to receive notifications for
* @param agent_name The agent which configures the policy being watched
* @param key The key identifying the policy map to receive notifications for.
* @param agent_name The agent which configures the policy being watched.
* No longer used.
* @param interest Receives notifications if and only if true.
*/
void watch_policy_map(policy_map_key_t const & key,
Expand Down Expand Up @@ -230,7 +242,10 @@ class EOS_SDK_PUBLIC policy_map_mgr : public base_mgr<policy_map_handler,

/**
* Applies or unapplies a policy map on the given interface and direction.
* @param policy_map_key_t Name and type of the policy map to [un]apply
* @param policy_map_key_t Name and type of the policy map to [un]apply.
* Note: When unapplying a PBR policy map, the specified interface's policy map
* will be unapplied regardless of whether it matches the specified policy map
* name.
* @param intf_id_t The interface ID of the interface to [un]apply
* the policy map.
* @param acl_direction_t The direction in which to [un]apply the policy map
Expand Down
2 changes: 1 addition & 1 deletion examples/PolicyRouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def watch_policy(self):
for name in self.watches_:
self.watch_policy_map(
eossdk.PolicyMapKey(name, eossdk.POLICY_FEATURE_PBR), False)
self.watches_ = frozenset(six.iterkeys(self.config_.policy))
self.watches_ = frozenset(self.config_.policy)
print( 'Adding new watches for %s' % list(self.config_.policy) )
for name in self.config_.policy:
self.watch_policy_map(
Expand Down
16 changes: 15 additions & 1 deletion nexthop_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ class nexthop_group_mgr_impl : public nexthop_group_mgr {
return true;
}

void nexthop_group_set(nexthop_group_t const &group) {
void nexthop_group_set(nexthop_group_t const & group) {
// TODO: No op impl.
}

void nexthop_group_set(nexthop_group_t const & group, uint16_t * version_id) {
// TODO: No op impl.
}

Expand Down Expand Up @@ -89,4 +93,14 @@ nexthop_group_handler::on_nexthop_group_programmed(std::string const & group_nam
// TODO: No op impl.
}

nexthop_group_handler_v2::nexthop_group_handler_v2(nexthop_group_mgr * mgr) :
nexthop_group_handler(mgr) {
}

void
nexthop_group_handler_v2::on_nexthop_group_programmed(std::string const & group_name,
uint16_t version_id) {
// TODO: No op impl.
}

}
5 changes: 5 additions & 0 deletions policy_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ policy_map_handler::policy_map_handler(policy_map_mgr * mgr) :
base_handler<policy_map_mgr, policy_map_handler>(mgr) {
}

void
policy_map_handler::watch_all_policy_maps(bool interest) {
// TODO: no op impl.
}

void
policy_map_handler::watch_policy_map(policy_map_key_t const & key,
bool interest) {
Expand Down

0 comments on commit d7cb9c8

Please sign in to comment.