class_map

Class map manipulation.

This module provides access to the management of class maps. Classification or “class” maps, provide a way for the network operator to classify packets arriving on an interface. Together with the policy_map_mgr in policy_map.h, classified traffic can drive policy features, such as PBR.

namespace eos
class class_map_iter_t
#include <class_map.h>

An iterator providing forwards only iteration over collections of class maps.

Private Functions

class_map_iter_t(class_map_iter_impl * const)

Friends

friend class class_map_iter_impl
class class_map_mgr
#include <class_map.h>

EOS class map manager.

This manager provides access to EOS traffic classifiers, or “class maps”. Class maps are referred to by policy maps (policy_map.h) to classify traffic that should be subject to the policy’s actions.

Public Functions

virtual ~class_map_mgr()
virtual void resync_init() = 0

Resync mediates class map configuration into a known good state.

To start a resync, call resync_init() and then use the functions in the module to manipulate class maps like normal, setting them with class_map_is(). After all entries have been set, call resync_complete(), which will delete existing class_maps that were not added or modified during resync.

During resync, this manager will act like it is referencing a temporary table that starts off empty. Thus, methods like exist, del, and getters will act only on that temporary table, regardless of the real values in Sysdb. The one exception is iteration; they will traverse the table stored in Sysdb, regardless of whether or not the manager is in resync mode.

virtual void resync_complete() = 0

Completes any underway resync operation.

virtual bool exists(class_map_key_t const & key) const = 0

Returns true if and only if the provided key exists in the system config.

virtual class_map_t class_map(class_map_key_t const & key) const = 0

Returns the class map for the provided class map key. If there is no class map for the key, returns a default class_map_t

virtual void class_map_is(class_map_t const & class_map) = 0

Sets a class map and commits its configuration.

virtual class_map_iter_t class_map_iter(policy_feature_t) const = 0

Provides iteration over the configured class maps for a feature.

virtual void class_map_del(class_map_key_t const & key) = 0

Deletes the class map specified.

Protected Functions

class_map_mgr()

Private Members

class_map_mgr

Type definitions in class_map

namespace eos

Typedefs

typedef policy_map_key_t class_map_key_t

Variables

std::string const CLASS_MAP_MPLS_ANY

A special class map name which means “match all MPLS traffic.”

Use as follows when defining a class_map_key_t:

    eos::class_map_key_t key(eos::CLASS_MAP_MPLS_ANY,
 eos::POLICY_FEATURE_PBR);
    eos::class_map_t cm(key);

Only one such rule can be set on any one policy map.

class class_map_rule_t
#include <class_map.h>

A class map match rule uses an ACL to match classified traffic. Values of this type are returned from the class_map_rule_iter, to program class maps, either supply one of these or the acl_key_t directly to class_map_mgr’s class_map_rule_set().

Public Functions

class_map_rule_t()
class_map_rule_t(acl_key_t const & acl_key)
acl_key_t acl_key() const

Getter for ‘acl_key’: the ACL name and type to use as a class map match rule.

bool operator==(class_map_rule_t const & other) const
bool operator!=(class_map_rule_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

acl_key_t acl_key_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of class_map_rule_t to the ostream.

class class_map_t
#include <class_map.h>

A class map classifies traffic to apply policy features to.

A class map can match IP or MPLS traffic. To match IP traffic, specify a class map matching one or more IPv4 ACLs (for PBR).

Public Functions

class_map_t()
class_map_t(class_map_key_t const & key)
class_map_key_t key() const

Getter for ‘key’: the class map key.

void key_is(class_map_key_t const & key)

Setter for ‘key’.

std::map< uint32_t, class_map_rule_t > const & rules() const

Getter for ‘rules’: the sequence of class map rules.

void rules_is(std::map< uint32_t, class_map_rule_t > const & rules)

Setter for ‘rules’.

void rule_set(uint32_t key, class_map_rule_t const & value)

inserts key/value pair to the map.

void rule_del(uint32_t key)

deletes the key/value pair from the map.

bool persistent() const

Getter for ‘persistent’: the persistence state for this class map.

When true, the class map will be stored in the running and startup configuration.

void persistent_is(bool persistent)

Setter for ‘persistent’.

bool operator==(class_map_t const & other) const
bool operator!=(class_map_t const & other) const
std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

class_map_key_t key_
std::map< uint32_t, class_map_rule_t > rules_
bool persistent_

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of class_map_t to the ostream.

Table Of Contents

Previous topic

base_mgr

Next topic

decap_group