|
| 1 | +# Copyright 2016 F5 Networks Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +TEST_MAC = '02:00:00:00:00:01' |
| 17 | + |
| 18 | + |
| 19 | +def test_tunnels_get_collection(mgmt_root): |
| 20 | + tunnels_collection = mgmt_root.tm.net.fdb.tunnels.get_collection() |
| 21 | + for tunnel in tunnels_collection: |
| 22 | + assert tunnel.name == 'http-tunnel' or tunnel.name == 'socks-tunnel' |
| 23 | + |
| 24 | + |
| 25 | +def test_tunnel_exists_load_update_refresh(mgmt_root): |
| 26 | + t_fact = mgmt_root.tm.net.fdb.tunnels.tunnel |
| 27 | + assert t_fact.exists(partition='Common', name='http-tunnel') |
| 28 | + assert t_fact.exists(partition='Common', name='socks-tunnel') |
| 29 | + http_tunnel = t_fact.load(partition='Common', name='http-tunnel') |
| 30 | + http2_tunnel = t_fact.load(partition='Common', name='http-tunnel') |
| 31 | + http_tunnel.update(records=TEST_MAC) |
| 32 | + http2_tunnel.refresh() |
| 33 | + assert http2_tunnel.records == [{u'name': u'02:00:00:00:00:01'}] |
| 34 | + http_tunnel.update(records=None) |
| 35 | + assert 'records' not in http_tunnel.__dict__ |
0 commit comments