Lucas Alvares Gomes 7b0fccfb5a Refactor some methods from OvsdbSbOvnIdl + unittests
This patch also refactor a few things in the OvsdbSbOvnIdl class:

*  is_provider_network() now returns a boolean, as expected by is_*
   methods.

* The methods get_ports_on_datapath() and _get_ports_by_datapath() were
  merged since they were the same thing.

* The methods get_evpn_info_from_port() and get_evpn_info() are now
  merged since they were the same thing.

* The methods get_evpn_info_from_crlrp_port_name() and
  get_evpn_info_from_lrp_port_name() were merged into
  get_evpn_info_from_port_name()

* get_ip_from_port_peer() now can raise PortNotFound

This patch also adds unittests for the methods in the OvsdbSbOvnIdl class.

Story: 2009165
Task: 43262

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Change-Id: I3d1e3b20727227f32d094deedc897d034ab6f7f6
2021-09-10 12:08:00 +01:00

19 lines
712 B
Python

# Copyright 2021 Red Hat, Inc.
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
def create_object(attr_dict):
return type('FakeObject', (object,), attr_dict)