You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

# Copyright 2016 Cloudbase Solutions.
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from import ip_lib
from neutron.tests.functional import base
TEST_IP = ''
TEST_MAC = '00:00:00:00:00:00'
class IpLibTestCase(base.BaseLoggingTestCase):
def test_ipwrapper_get_device_by_ip_None(self):
def test_ipwrapper_get_device_by_ip(self):
ip_dev = ip_lib.IPWrapper().get_device_by_ip(TEST_IP)
def test_device_has_ip(self):
not_a_device = ip_lib.IPDevice('#!#._not_a_device_bleargh!!@@@')
def test_ip_link_read_mac_address(self):
ip_dev = ip_lib.IPWrapper().get_device_by_ip(TEST_IP)
self.assertEqual([TEST_MAC], ip_lib.IPLink(ip_dev).address)
def test_ip_link_read_mac_address_wrong(self):
not_a_device = ip_lib.IPDevice('#!#._not_a_device_bleargh!!@@@')
mac_addr = ip_lib.IPLink(not_a_device).address