35 std::shared_ptr<VOM::tap_interface> intf = itf.
singular();
41 std::shared_ptr<VOM::tap_interface> intf1 = itf1.
singular();
46 std::shared_ptr<VOM::tap_interface> intf2 = itf2.
singular();
51 std::cout <<
"Interface index is INVALID" << std::endl;
58 std::cout <<
"Interface #1 index is " << intf->handle().value() << std::endl;
59 std::cout <<
"Interface #2 index is " << intf1->handle().value() << std::endl;
60 std::cout <<
"Interface #3 index is " << intf2->handle().value() << std::endl;
63 intf->enable_stats(listen);
64 intf1->enable_stats(listen);
65 intf2->enable_stats(listen);
70 std::cout <<
"stats # " << std::to_string(i) << std::endl;
74 intf->disable_stats();
78 intf1->disable_stats();
79 intf2->disable_stats();
static void read_stats()
read stats from stat segment
void handle_interface_stat(const VOM::interface &itf)
Virtual function called on the listener when the command has data ready to process.
const stats_t & get_stats(void) const
Get the interface stats.
static const handle_t INVALID
A value of an interface handle_t that means the itf does not exist.
int main()
Run VPP on another terminal before running vom_stats_test.
const std::string & name() const
Return the interface type.
static bool connect()
Blocking Connect to VPP.
static void remove(const client_db::key_t &key)
Remove all object in the OM referenced by the key.
A class that listens to interface Stats.
The pipe to VPP into which we write the commands.
sll srl srl sll sra u16x4 i
A representation of an interface in VPP.
static void init()
Initialise the HW.
static void disconnect()
Disconnect to VPP.
static rc_t write(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
static const admin_state_t UP
Admin UP state.
static const prefix_t ZERO
The all Zeros prefix.
std::shared_ptr< tap_interface > singular() const
Return the matching 'singular instance' of the TAP interface.