Пример #1
0
    def test_can_get_view_names(self, mock_request):
        test_platform = TestPlatform('127.0.0.1',
                                     rest_port=11009,
                                     platform='windows')

        # use the default session and get the root node of the hierarchy
        ixnetwork = test_platform.Sessions.find().Ixnetwork

        #GetViewNames fetches all the available view on Ixnetwork server.
        statList = StatViewAssistant.GetViewNames(ixnetwork)
        assert (len(statList) == 3)
Пример #2
0

# connect to a windows test platform using the default api server rest port
test_platform = TestPlatform('127.0.0.1', rest_port=11009, platform='windows')

# use the default session and get the root node of the hierarchy
ixnetwork = test_platform.Sessions.find().Ixnetwork

ixnetwork.info('negative test')
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