示例#1
0
def test_FaucetProxy():
    """
    Tests Faucet
    """
    # with a host
    proxy = FaucetProxy(host='foo')
    proxy.get_switches()
    proxy.get_ports()
    proxy.get_vlans()
    proxy.get_span_fabric()
    proxy.get_byip('10.0.0.9')
    proxy.get_bymac('00:00:00:00:12:00')
    proxy.shutdown_ip('10.0.0.9')
    proxy.shutdown_endpoint()
    proxy.get_highest()
    proxy.get_seq_by_ip()
    proxy.mirror_ip('192.168.1.50')
    proxy.mirror_ip('192.168.1.41')
    proxy.unmirror_ip('10.0.0.1')

    # without a host
    proxy = FaucetProxy()
    proxy.get_switches()
    proxy.get_ports()
    proxy.get_vlans()
    proxy.get_span_fabric()
    proxy.get_byip('10.0.0.9')
    proxy.get_bymac('00:00:00:00:12:00')
    proxy.shutdown_ip('10.0.0.9')
    proxy.shutdown_endpoint()
    proxy.get_highest()
    proxy.get_seq_by_ip()
    proxy.mirror_ip('192.168.1.50')
    proxy.mirror_ip('192.168.1.41')
    proxy.unmirror_ip('10.0.0.1')
示例#2
0
def test_FaucetProxy():
    """
    Tests Faucet
    """
    # with a host
    proxy = FaucetProxy(host='foo')
    proxy.get_switches()
    proxy.get_ports()
    proxy.get_vlans()
    proxy.get_span_fabric()
    proxy.get_byip('10.0.0.9')
    proxy.get_bymac('00:00:00:00:12:00')
    proxy.shutdown_ip('10.0.0.9')
    proxy.shutdown_endpoint()
    proxy.get_highest()
    proxy.get_seq_by_ip()
    proxy.mirror_mac('00:00:00:00:00:00')
    proxy.mirror_mac('00:00:00:00:00:01')
    proxy.unmirror_mac('00:00:00:00:00:00')

    # without a host
    proxy = FaucetProxy()
    proxy.get_switches()
    proxy.get_ports()
    proxy.get_vlans()
    proxy.get_span_fabric()
    proxy.get_byip('10.0.0.9')
    proxy.get_bymac('00:00:00:00:12:00')
    proxy.shutdown_ip('10.0.0.9')
    proxy.shutdown_endpoint()
    proxy.get_highest()
    proxy.get_seq_by_ip()
    proxy.mirror_mac('00:00:00:00:00:00')
    proxy.mirror_mac('00:00:00:00:00:01')
    proxy.unmirror_mac('00:00:00:00:00:00')

    # without a host and messages
    proxy = FaucetProxy()
    proxy.get_switches()
    proxy.get_ports()
    proxy.get_vlans()
    proxy.get_span_fabric()
    proxy.get_byip('10.0.0.9')
    proxy.get_bymac('00:00:00:00:12:00')
    proxy.shutdown_ip('10.0.0.9')
    proxy.shutdown_endpoint()
    proxy.get_highest()
    proxy.get_seq_by_ip()
    proxy.mirror_mac('00:00:00:00:00:00',
                     messages=[{
                         'dp_name': 'switch',
                         'L2_LEARN': {
                             'l3_src_ip': '10.0.0.1',
                             'eth_src': '00:00:00:00:00:00',
                             'port_no': 1,
                             'vid': '100'
                         }
                     }, {
                         'version': 1,
                         'time': 1525205350.0357792,
                         'dp_id': 1,
                         'dp_name': 'switch-1',
                         'event_id': 5,
                         'PORT_CHANGE': {
                             'port_no': 1,
                             'reason': 'MODIFY',
                             'status': False
                         }
                     }, {}])
    proxy.mirror_mac('00:00:00:00:00:01')
    proxy.unmirror_mac('00:00:00:00:00:00',
                       messages=[{
                           'dp_name': 'switch',
                           'L2_LEARN': {
                               'l3_src_ip': '10.0.0.1',
                               'eth_src': '00:00:00:00:00:00',
                               'port_no': 1,
                               'vid': '100'
                           }
                       }, {
                           'version': 1,
                           'time': 1525205350.0357792,
                           'dp_id': 1,
                           'dp_name': 'switch-1',
                           'event_id': 5,
                           'PORT_CHANGE': {
                               'port_no': 1,
                               'reason': 'MODIFY',
                               'status': False
                           }
                       }, {}])