ROFL-pipeline
v0.6.0dev
|
Mananagement of the system's/device state (physical switch), including logical switches and ports. More...
Modules | |
OpenFlow asynchronous events and hooks APIs | |
APIs that library consumes to communicate asynchronous events (as well as some other hooks) to the endpoint or an intermediate layer; must be implemented by the library users. | |
Macros | |
#define | PHYSICAL_SWITCH_MAX_LS 64 |
Maximum number of logical switches that can be instantiated. More... | |
#define | PHYSICAL_SWITCH_MAX_NUM_PHY_PORTS 1024 |
Maximum number of phyisical ports. More... | |
#define | PHYSICAL_SWITCH_MAX_NUM_VIR_PORTS 256 |
Maximum number of virtual ports. More... | |
#define | PHYSICAL_SWITCH_MAX_NUM_TUN_PORTS 32 |
Maximum number of tunnel ports. More... | |
Functions | |
void | monitoring_dump (monitoring_state_t *monitoring) |
Dumps the monitoring state, only meaningful for debugging purposes. More... | |
static void | monitoring_dump_snapshot (monitoring_snapshot_state_t *snapshot) |
Dumps the monitoring state of a snapshot. More... | |
static bool | monitoring_has_changed (monitoring_state_t *state, uint64_t *last_seen_rev) |
Returns true if the monitoring state has changed. More... | |
monitoring_snapshot_state_t * | monitoring_get_snapshot (monitoring_state_t *monitoring) |
Get a snapshot of the current monitoring state. More... | |
static monitoring_snapshot_state_t * | monitoring_clone_snapshot (monitoring_snapshot_state_t *orig) |
Clone a monitoring snapshot. More... | |
static void | monitoring_destroy_snapshot (monitoring_snapshot_state_t *snapshot) |
Destroy a snapshot previously generated via monitoring_get_snapshot() routine. More... | |
monitored_entity_t * | monitoring_add_monitored_entity (monitoring_state_t *monitoring, enum monitored_entity_type type, monitored_entity_t *prev, monitored_entity_t *parent) |
Creates a monitored entity object and links it to the linked-list, in the position of prev OR parent. More... | |
static rofl_result_t | monitoring_remove_monitored_entity (monitoring_state_t *monitoring, monitored_entity_t *entity) |
Destroys an detaches monitored entity object. More... | |
void | of_switch_destroy_snapshot (of_switch_snapshot_t *snapshot) |
Destroy a previously generated snapshot. More... | |
ROFL_BEGIN_DECLS rofl_result_t | physical_switch_init (void) |
Initializes the physical switch. More... | |
physical_switch_t * | get_physical_switch (void) |
Get the reference to the (unique) physical switch. More... | |
void | physical_switch_destroy (void) |
Destroys the physical switch state. More... | |
of_switch_t ** | physical_switch_get_logical_switches (unsigned int *max_switches) |
Retrieves the list of logical switches within the logical switch. More... | |
rofl_result_t | physical_switch_add_logical_switch (of_switch_t *sw) |
Add a logical switch to the pool. More... | |
rofl_result_t | physical_switch_remove_logical_switch_by_dpid (const uint64_t dpid) |
Attemps to remove AND destroy a previously added logical switch from the pool by dpid. More... | |
rofl_result_t | physical_switch_remove_logical_switch (of_switch_t *sw) |
Attemps to remove AND destroy a previously added logical switch from the pool. More... | |
of_switch_t * | physical_switch_get_logical_switch_by_dpid (const uint64_t dpid) |
Attemps to retrieve a logical switch from the pool by its dpid. More... | |
of_switch_t * | physical_switch_get_logical_switch_attached_to_port (const switch_port_t port) |
Attemps to retrieve the logical switch attached to the port. More... | |
switch_port_t * | physical_switch_get_port_by_name (const char *name) |
Retrieve a physical switch port by name. More... | |
switch_port_t ** | physical_switch_get_physical_ports (unsigned int *max_ports) |
Get the reference to the physical ports. More... | |
switch_port_t ** | physical_switch_get_virtual_ports (unsigned int *max_ports) |
Get the reference to the virtual ports. More... | |
switch_port_t ** | physical_switch_get_tunnel_ports (unsigned int *max_ports) |
Get the reference to the physical ports. More... | |
rofl_result_t | physical_switch_add_port (switch_port_t *port) |
Adds a port to the physical_switch pool portAttempts to add a port to the physical switch pool port. More... | |
rofl_result_t | physical_switch_remove_port (const char *name) |
Removes and destroys a port from the physical_switch pool referenced by its nameAttempts to remove AND destroy a port referenced by name. More... | |
switch_port_t * | physical_switch_get_port_by_num (const uint64_t dpid, unsigned int port_num) |
Retrieve a port attached to logical switch with dpid at port num. More... | |
rofl_result_t | get_logical_switch_ports (of_switch_t *sw, logical_switch_port_t **ports, unsigned int *num_of_ports, unsigned int *logical_sw_max_ports) |
Retrieve the physical port list. More... | |
rofl_result_t | physical_switch_attach_port_to_logical_switch (switch_port_t *port, of_switch_t *sw, unsigned int *port_num) |
Attaches port to logical switch. More... | |
rofl_result_t | physical_switch_attach_port_to_logical_switch_at_port_num (switch_port_t *port, of_switch_t *sw, unsigned int port_num) |
Attaches port to logical switch at port number port_num. More... | |
rofl_result_t | physical_switch_detach_port_num_from_logical_switch (unsigned int port_num, of_switch_t *sw) |
Detaches port located at port_num from logical switch sw. More... | |
rofl_result_t | physical_switch_detach_port_from_logical_switch (switch_port_t *port, of_switch_t *sw) |
Detaches port from logical switch sw. More... | |
rofl_result_t | physical_switch_detach_all_ports_from_logical_switch (of_switch_t *sw) |
Detaches all the ports from the logical switch. More... | |
static monitoring_state_t * | physical_switch_get_monitoring (void) |
Retrieves the monitoring state of the physicals witch. More... | |
switch_port_name_list_t * | physical_switch_get_all_port_names (void) |
Gets a list of port names of all (currently) available port names. More... | |
switch_port_snapshot_t * | physical_switch_get_port_snapshot (const char *name) |
Gets a snapshot of the current port state, if it exists. More... | |
void | dpid_list_destroy (dpid_list_t *list) |
Destroy a previously generated list of dpids. More... | |
of_switch_snapshot_t * | physical_switch_get_logical_switch_snapshot (const uint64_t dpid) |
Generates a snapshot of the current running state of a LSI, which can be safely read and iterated over time. More... | |
ROFL_BEGIN_DECLS switch_port_t * | switch_port_init (char *name, bool up, port_type_t type, port_state_t state) |
Init a switch_port structure. More... | |
rofl_result_t | switch_port_destroy (switch_port_t *port) |
Destroy a switch_port structure. More... | |
rofl_result_t | switch_port_add_queue (switch_port_t *port, uint32_t id, char *name, uint16_t length, uint16_t min_rate, uint16_t max_rate) |
Add queue to port. More... | |
rofl_result_t | switch_port_remove_queue (switch_port_t *port, uint32_t id) |
Remove queue from port. More... | |
void | switch_port_add_capabilities (bitmap32_t *bitmap, bitmap32_t features) |
Adds capabilities to the port. More... | |
void | switch_port_remove_capabilities (bitmap32_t *bitmap, bitmap32_t features) |
Removes capabilities to the port. More... | |
void | switch_port_set_current_speed (switch_port_t *port, port_features_t speed) |
Sets current speed. More... | |
void | switch_port_set_current_max_speed (switch_port_t *port, port_features_t speed) |
Sets current MAX speed. More... | |
switch_port_snapshot_t * | switch_port_clone_snapshot (switch_port_snapshot_t *orig) |
Clone a snapshot. More... | |
void | switch_port_destroy_snapshot (switch_port_snapshot_t *snapshot) |
Destroy a switch port snapshot. More... | |
void | switch_port_name_list_destroy (switch_port_name_list_t *list) |
Destroys a port name list, previously generated by calling fwd_module_get_all_port_names() More... | |
Mananagement of the system's/device state (physical switch), including logical switches and ports.
Exposes the api for managing so-called physical switch (the platform), including logical switches and platform ports.
This is roughly:
#define PHYSICAL_SWITCH_MAX_LS 64 |
Maximum number of logical switches that can be instantiated.
Definition at line 100 of file physical_switch.h.
#define PHYSICAL_SWITCH_MAX_NUM_PHY_PORTS 1024 |
Maximum number of phyisical ports.
Definition at line 108 of file physical_switch.h.
#define PHYSICAL_SWITCH_MAX_NUM_TUN_PORTS 32 |
Maximum number of tunnel ports.
Definition at line 124 of file physical_switch.h.
#define PHYSICAL_SWITCH_MAX_NUM_VIR_PORTS 256 |
Maximum number of virtual ports.
Definition at line 116 of file physical_switch.h.
void dpid_list_destroy | ( | dpid_list_t * | list | ) |
Destroy a previously generated list of dpids.
Definition at line 668 of file physical_switch.c.
rofl_result_t get_logical_switch_ports | ( | of_switch_t * | sw, |
logical_switch_port_t ** | ports, | ||
unsigned int * | num_of_ports, | ||
unsigned int * | logical_sw_max_ports | ||
) |
Retrieve the physical port list.
num_of_ports | Pointer to an int. Number of ports will be filled by the lib. |
physical_switch_t* get_physical_switch | ( | void | ) |
Get the reference to the (unique) physical switch.
Definition at line 82 of file physical_switch.c.
monitored_entity_t* monitoring_add_monitored_entity | ( | monitoring_state_t * | monitoring, |
enum monitored_entity_type | type, | ||
monitored_entity_t * | prev, | ||
monitored_entity_t * | parent | ||
) |
Creates a monitored entity object and links it to the linked-list, in the position of prev OR parent.
If no monitoring reference is passed, then an unlinked instance will be returned.
Definition at line 85 of file monitoring.c.
|
inlinestatic |
Clone a monitoring snapshot.
Definition at line 248 of file monitoring.h.
|
inlinestatic |
Destroy a snapshot previously generated via monitoring_get_snapshot() routine.
Definition at line 256 of file monitoring.h.
void monitoring_dump | ( | monitoring_state_t * | monitoring | ) |
Dumps the monitoring state, only meaningful for debugging purposes.
Definition at line 316 of file monitoring.c.
|
inlinestatic |
Dumps the monitoring state of a snapshot.
Definition at line 216 of file monitoring.h.
monitoring_snapshot_state_t* monitoring_get_snapshot | ( | monitoring_state_t * | monitoring | ) |
Get a snapshot of the current monitoring state.
This function may be expensive, as it involves a deep copy in dynamic memory of all the monitored data.
The monitoring is copied atomically (platform_rdlock) over the read lock The monitoring snapshots needs to be destroyed by calling monitoring_destroy_snapshot()
Definition at line 343 of file monitoring.c.
|
inlinestatic |
Returns true if the monitoring state has changed.
Definition at line 227 of file monitoring.h.
|
inlinestatic |
Destroys an detaches monitored entity object.
Definition at line 275 of file monitoring.h.
void of_switch_destroy_snapshot | ( | of_switch_snapshot_t * | snapshot | ) |
Destroy a previously generated snapshot.
Definition at line 139 of file of_switch.c.
rofl_result_t physical_switch_add_logical_switch | ( | of_switch_t * | sw | ) |
Add a logical switch to the pool.
This call adds a previously initialized logical switch to the current logical switch pool
sw | Pointer to an of_switch_t structure. The switch must have been previously initialized using ofXX_init_switch() call. |
Definition at line 366 of file physical_switch.c.
rofl_result_t physical_switch_add_port | ( | switch_port_t * | port | ) |
Adds a port to the physical_switch pool portAttempts to add a port to the physical switch pool port.
port | switch_port_t instance previously created via switch_port_init(). The name of the port MUST be unique. On success the instance of switch_port_t cannot be further modified or deleted externally (port will be destroyed by the physical_switch itself) |
Definition at line 214 of file physical_switch.c.
rofl_result_t physical_switch_attach_port_to_logical_switch | ( | switch_port_t * | port, |
of_switch_t * | sw, | ||
unsigned int * | port_num | ||
) |
Attaches port to logical switch.
port_num | Pointer to an int. The LS port number (OF number), will be filled. |
Definition at line 449 of file physical_switch.c.
rofl_result_t physical_switch_attach_port_to_logical_switch_at_port_num | ( | switch_port_t * | port, |
of_switch_t * | sw, | ||
unsigned int | port_num | ||
) |
Attaches port to logical switch at port number port_num.
The attachment may fail if there is already a port attached or another port was previously attached there (reuse of port numbers is strictly forbidden).
port_num | The LS port number (OF number) where to attach port. |
Definition at line 466 of file physical_switch.c.
void physical_switch_destroy | ( | void | ) |
Destroys the physical switch state.
This call destroys the physical switch state. This call will NOT destroy any logical switch or any port switch previously placed in the physical switch port list.
Definition at line 97 of file physical_switch.c.
rofl_result_t physical_switch_detach_all_ports_from_logical_switch | ( | of_switch_t * | sw | ) |
Detaches all the ports from the logical switch.
Definition at line 517 of file physical_switch.c.
rofl_result_t physical_switch_detach_port_from_logical_switch | ( | switch_port_t * | port, |
of_switch_t * | sw | ||
) |
Detaches port from logical switch sw.
Definition at line 499 of file physical_switch.c.
rofl_result_t physical_switch_detach_port_num_from_logical_switch | ( | unsigned int | port_num, |
of_switch_t * | sw | ||
) |
Detaches port located at port_num from logical switch sw.
Definition at line 483 of file physical_switch.c.
switch_port_name_list_t* physical_switch_get_all_port_names | ( | void | ) |
Gets a list of port names of all (currently) available port names.
List | of available port names, which MUST be deleted using physical_switch_destroy_port_name_list(). |
Definition at line 540 of file physical_switch.c.
of_switch_t* physical_switch_get_logical_switch_attached_to_port | ( | const switch_port_t | port | ) |
Attemps to retrieve the logical switch attached to the port.
Definition at line 444 of file physical_switch.c.
of_switch_t* physical_switch_get_logical_switch_by_dpid | ( | const uint64_t | dpid | ) |
Attemps to retrieve a logical switch from the pool by its dpid.
Definition at line 354 of file physical_switch.c.
of_switch_snapshot_t* physical_switch_get_logical_switch_snapshot | ( | const uint64_t | dpid | ) |
Generates a snapshot of the current running state of a LSI, which can be safely read and iterated over time.
Should be deleted using of_switch_destroy_snapshot()
Definition at line 673 of file physical_switch.c.
of_switch_t** physical_switch_get_logical_switches | ( | unsigned int * | max_switches | ) |
Retrieves the list of logical switches within the logical switch.
max_switches | Number of maximum switches in the array (array boundary) |
Pointer | to the of_switch_t* array. This array cannot be modified is READ-ONLY! |
Definition at line 345 of file physical_switch.c.
|
inlinestatic |
Retrieves the monitoring state of the physicals witch.
Definition at line 429 of file physical_switch.h.
switch_port_t** physical_switch_get_physical_ports | ( | unsigned int * | max_ports | ) |
Get the reference to the physical ports.
max_ports | Number of maximum ports in the array (array boundary) |
Pointer | to the switch_port_t* array. This array cannot be modified is READ-ONLY! |
Definition at line 174 of file physical_switch.c.
switch_port_t* physical_switch_get_port_by_name | ( | const char * | name | ) |
Retrieve a physical switch port by name.
Attempts to retrieve a port previously added to the physical switch by its name.
Definition at line 144 of file physical_switch.c.
switch_port_t* physical_switch_get_port_by_num | ( | const uint64_t | dpid, |
unsigned int | port_num | ||
) |
Retrieve a port attached to logical switch with dpid at port num.
Attempts to retrieve a port previously added to the phyisical switch and attached to the logical switch identified by the dpid and attached to port number
dpid | Datapath ID of the switch |
port_num | Port number |
Definition at line 192 of file physical_switch.c.
switch_port_snapshot_t* physical_switch_get_port_snapshot | ( | const char * | name | ) |
Gets a snapshot of the current port state, if it exists.
Port | snapshot on success, NULL otherwise. Shall be deleted using switch_port_destroy_snapshot() |
Definition at line 607 of file physical_switch.c.
switch_port_t** physical_switch_get_tunnel_ports | ( | unsigned int * | max_ports | ) |
Get the reference to the physical ports.
max_ports | Number of maximum ports in the array (array boundary) |
Pointer | to the switch_port_t* array. This array cannot be modified is READ-ONLY! |
Definition at line 184 of file physical_switch.c.
switch_port_t** physical_switch_get_virtual_ports | ( | unsigned int * | max_ports | ) |
Get the reference to the virtual ports.
max_ports | Number of maximum ports in the array (array boundary) |
Pointer | to the switch_port_t* array. This array cannot be modified is READ-ONLY! |
Definition at line 179 of file physical_switch.c.
ROFL_BEGIN_DECLS rofl_result_t physical_switch_init | ( | void | ) |
Initializes the physical switch.
This call must be done before anyone else.
Definition at line 34 of file physical_switch.c.
rofl_result_t physical_switch_remove_logical_switch | ( | of_switch_t * | sw | ) |
Attemps to remove AND destroy a previously added logical switch from the pool.
Definition at line 434 of file physical_switch.c.
rofl_result_t physical_switch_remove_logical_switch_by_dpid | ( | const uint64_t | dpid | ) |
Attemps to remove AND destroy a previously added logical switch from the pool by dpid.
Definition at line 395 of file physical_switch.c.
rofl_result_t physical_switch_remove_port | ( | const char * | name | ) |
Removes and destroys a port from the physical_switch pool referenced by its nameAttempts to remove AND destroy a port referenced by name.
If multiple ports have the same name, only the first one will be deleted.
name | Port name |
Definition at line 283 of file physical_switch.c.
void switch_port_add_capabilities | ( | bitmap32_t * | bitmap, |
bitmap32_t | features | ||
) |
Adds capabilities to the port.
Definition at line 133 of file switch_port.c.
rofl_result_t switch_port_add_queue | ( | switch_port_t * | port, |
uint32_t | id, | ||
char * | name, | ||
uint16_t | length, | ||
uint16_t | min_rate, | ||
uint16_t | max_rate | ||
) |
Add queue to port.
Definition at line 92 of file switch_port.c.
switch_port_snapshot_t* switch_port_clone_snapshot | ( | switch_port_snapshot_t * | orig | ) |
Clone a snapshot.
Definition at line 183 of file switch_port.c.
rofl_result_t switch_port_destroy | ( | switch_port_t * | port | ) |
Destroy a switch_port structure.
Definition at line 66 of file switch_port.c.
void switch_port_destroy_snapshot | ( | switch_port_snapshot_t * | snapshot | ) |
Destroy a switch port snapshot.
Definition at line 195 of file switch_port.c.
ROFL_BEGIN_DECLS switch_port_t* switch_port_init | ( | char * | name, |
bool | up, | ||
port_type_t | type, | ||
port_state_t | state | ||
) |
Init a switch_port structure.
Definition at line 11 of file switch_port.c.
void switch_port_name_list_destroy | ( | switch_port_name_list_t * | list | ) |
Destroys a port name list, previously generated by calling fwd_module_get_all_port_names()
Definition at line 201 of file switch_port.c.
void switch_port_remove_capabilities | ( | bitmap32_t * | bitmap, |
bitmap32_t | features | ||
) |
Removes capabilities to the port.
Definition at line 136 of file switch_port.c.
rofl_result_t switch_port_remove_queue | ( | switch_port_t * | port, |
uint32_t | id | ||
) |
Remove queue from port.
Definition at line 113 of file switch_port.c.
void switch_port_set_current_max_speed | ( | switch_port_t * | port, |
port_features_t | speed | ||
) |
Sets current MAX speed.
Definition at line 144 of file switch_port.c.
void switch_port_set_current_speed | ( | switch_port_t * | port, |
port_features_t | speed | ||
) |
Sets current speed.
Definition at line 139 of file switch_port.c.