Skip to content

Commit

Permalink
Merge pull request #113 from miha-plesko/floatingip-router-relation
Browse files Browse the repository at this point in the history
Relate FloatingIp to NetworkRouter
  • Loading branch information
Ladas authored Jul 23, 2018
2 parents 9b13050 + 2591575 commit 7a92952
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def floating_ips
persister.floating_ips.find_or_build(ip['ID']).assign_attributes(
:address => ip['address'],
:cloud_network => persister.cloud_networks.lazy_find(ip['associatedSharedNetworkResourceID']),
# TODO(miha-plesko): uncomment when https://github.com/ManageIQ/manageiq-schema/pull/217 is merged
# :network_router => persister.network_routers.lazy_find(ip['parentID']),
:network_router => persister.network_routers.lazy_find(ip['parentID']),
:cloud_tenant => persister.network_routers.lazy_find(ip['parentID'], :key => :cloud_tenant)
)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
class ManageIQ::Providers::Nuage::NetworkManager::NetworkRouter < ::NetworkRouter
has_many :floating_ips, :dependent => :destroy

# TODO(miha-plesko): remove when https://github.com/ManageIQ/manageiq-schema/pull/217 is merged
def floating_ips
FloatingIp.none
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ def assert_floating_ips
:cloud_tenant_id => CloudTenant.find_by(:ems_ref => tenant_ref2).id,
:type => 'ManageIQ::Providers::Nuage::NetworkManager::FloatingIp'
)
# TODO(miha-plesko): uncomment when https://github.com/ManageIQ/manageiq-schema/pull/217 is merged
# expect(NetworkRouter.find_by(:ems_ref => router_ref).floating_ips).to include(ip)
router = NetworkRouter.find_by(:ems_ref => router_ref)
expect(ip.network_router).to eq(router)
expect(router.floating_ips).to include(ip)
end

def assert_cloud_networks
Expand Down

0 comments on commit 7a92952

Please sign in to comment.