def _check_link_state(self, LinkUpTimeout): self._IxNetwork.info('Checking virtual port link states') view = StatViewAssistant(self._IxNetwork, 'Port Statistics', Timeout=LinkUpTimeout) view.AddRowFilter('Port Name', StatViewAssistant.REGEX, self._get_name_regex()) view.CheckCondition('Link State', StatViewAssistant.REGEX, '^Link Up$', Timeout=LinkUpTimeout)
try: StatViewAssistant(ixnetwork, 'my test view', Timeout=5) except NotFoundError as e: ixnetwork.info(e) # get a list of all current statistic views that can be used in the StatViewAssistant print(StatViewAssistant.GetViewNames(ixnetwork)) # create a stat view assistant for a statistics view port_statistics = StatViewAssistant(ixnetwork, 'Port Statistics') # print all the rows for a statistics view print(port_statistics) # add a filter so that only a single row is retrieved port_statistics.AddRowFilter('Port Name', StatViewAssistant.REGEX, 'Port 1$') print(port_statistics) # demonstrate cell access port_statistics.ClearRowFilters() rows = port_statistics.Rows # get the cell value at row 0, column 'Port Name' print(rows[0]['Port Name']) # get the cell value at row 1, column 'Stat Name' print(rows[1]['Stat Name']) # get the cell value at the first row that matches a regex of 'case insensitive endswith port 1', column 'Frames Tx.' print(rows['(?i)port 1$']['Frames Tx.'])
pe2Bgp.FilterEvpn.Single(True) pe2Evi = pe2Bgp.BgpIPv4EvpnEvi.add() pe2Evi.RdEvi.ValueList(['1', '2']) ce2Pool = pe2DevGroup1.NetworkGroup.add(Name='CE2') ce2MacPool = ce2Pool.MacPools.add(Name='Mac - Customers') pe2Evi.EnableL3vniTargetList.Single(True) ce2V4Pool = ce2MacPool.Ipv4PrefixPools.add(Name='L3 - Customers') ixNetwork.StartAllProtocols(Arg1='sync') ixNetwork.info('Verify protocol sessions\n') protocolsSummary = StatViewAssistant(ixNetwork, 'Protocols Summary') protocolsSummary.AddRowFilter('Protocol Type', StatViewAssistant.REGEX, '(?i)^BGP?') protocolsSummary.CheckCondition('Sessions Not Started', StatViewAssistant.GREATER_THAN_OR_EQUAL, 0) protocolsSummary.CheckCondition('Sessions Down', StatViewAssistant.EQUAL, 0) ixNetwork.info(protocolsSummary) ixNetwork.info('Create Traffic Item') traffCe1ToCe2 = ixNetwork.Traffic.TrafficItem.add( Name='CE1 to CE2 Traffic', BiDirectional=False, TrafficType='ipv4') ixNetwork.info('Add endpoint flow group') traffCe1ToCe2.EndpointSet.add(Sources=ce1V4Pool, Destinations=ce2V4Pool) configElement = traffCe1ToCe2.ConfigElement.find()[0] configElement.FrameRate.update(Type='percentLineRate', Rate=50) configElement.TransmissionControl.update(Type='fixedFrameCount', FrameCount=100000)