Skip to content

Commit

Permalink
fetch reservations with sliver for fabnetext allocated IPs
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Aug 6, 2024
1 parent a8bec12 commit bb48904
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion fabric_cf/actor/core/apis/abc_actor_management_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
slice_id: ID = None, rid: ID = None, oidc_claim_sub: str = None,
email: str = None, rid_list: List[str] = None, type: str = None,
site: str = None, node_id: str = None,
host: str = None, ip_subnet: str = None) -> ResultReservationAvro:
host: str = None, ip_subnet: str = None, full: bool = False) -> ResultReservationAvro:
"""
Get Reservations
@param states states
Expand All @@ -255,6 +255,7 @@ def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
@param caller caller
@param host host
@param ip_subnet ip subnet
@param full
@return returns list of the reservations
"""
Expand Down
3 changes: 2 additions & 1 deletion fabric_cf/actor/core/apis/abc_mgmt_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def accept_update_slice(self, *, slice_id: ID) -> bool:
def get_reservations(self, *, states: List[int] = None, slice_id: ID = None,
rid: ID = None, oidc_claim_sub: str = None, email: str = None, rid_list: List[str] = None,
type: str = None, site: str = None, node_id: str = None,
host: str = None, ip_subnet: str = None) -> List[ReservationMng]:
host: str = None, ip_subnet: str = None, full: bool = False) -> List[ReservationMng]:
"""
Get Reservations
@param states states
Expand All @@ -165,6 +165,7 @@ def get_reservations(self, *, states: List[int] = None, slice_id: ID = None,
@param node_id node id
@param ip_subnet ip subnet
@param host host
@param full
Obtains all reservations
@return returns list of the reservations
"""
Expand Down
5 changes: 3 additions & 2 deletions fabric_cf/actor/core/manage/actor_management_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
slice_id: ID = None, rid: ID = None, oidc_claim_sub: str = None,
email: str = None, rid_list: List[str] = None, type: str = None,
site: str = None, node_id: str = None, host: str = None,
ip_subnet: str = None) -> ResultReservationAvro:
ip_subnet: str = None, full: bool = False) -> ResultReservationAvro:
result = ResultReservationAvro()
result.status = ResultAvro()

Expand Down Expand Up @@ -465,7 +465,8 @@ def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
r_slice_id = r.get_slice_id()
slice_obj = self.get_slice_by_guid(guid=r_slice_id)
r.restore(actor=self.actor, slice_obj=slice_obj)
full = True if slice_id or rid else False
if not full:
full = True if slice_id or rid else False
rr = Converter.fill_reservation(reservation=r, full=full)
result.reservations.append(rr)
except ReservationNotFoundException as e:
Expand Down
4 changes: 2 additions & 2 deletions fabric_cf/actor/core/manage/local/local_actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ def remove_slice(self, *, slice_id: ID) -> bool:
def get_reservations(self, *, states: List[int] = None, slice_id: ID = None,
rid: ID = None, oidc_claim_sub: str = None, email: str = None, rid_list: List[str] = None,
type: str = None, site: str = None, node_id: str = None,
host: str = None, ip_subnet: str = None) -> List[ReservationMng]:
host: str = None, ip_subnet: str = None, full: bool = False) -> List[ReservationMng]:
self.clear_last()
try:
result = self.manager.get_reservations(caller=self.auth, states=states, slice_id=slice_id, rid=rid,
oidc_claim_sub=oidc_claim_sub, email=email, rid_list=rid_list,
type=type, site=site, node_id=node_id, host=host,
ip_subnet=ip_subnet)
ip_subnet=ip_subnet, full=full)
self.last_status = result.status

if result.status.get_code() == 0:
Expand Down
5 changes: 3 additions & 2 deletions fabric_cf/orchestrator/core/orchestrator_slice_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ def __check_modify_on_fabnetv4ext(self, *, rid: str, req_sliver: NetworkServiceS
if req_sliver.labels is not None and req_sliver.labels.ipv4 is not None and len(req_sliver.labels.ipv4) > 0:
bqm_graph_id, owner_mpls_node_id = req_sliver.get_node_map()

existing_reservations = self.controller.get_reservations(node_id=owner_mpls_node_id, states=states)
existing_reservations = self.controller.get_reservations(node_id=owner_mpls_node_id, states=states,
full=True)
ip_network = IPv4Network(req_sliver.gateway.lab.ipv4_subnet)
ipaddress_list = list(ip_network.hosts())
ipaddress_list.pop(0)
Expand All @@ -651,7 +652,7 @@ def __check_modify_on_fabnetv4ext(self, *, rid: str, req_sliver: NetworkServiceS
continue

if not reservation.get_sliver():
self.logger.warning(f"No sliver found, Skipping reservation: {reservation}")
self.logger.warning(f"No sliver found, Skipping reservation: {reservation.get_reservation_id()}")
continue

if reservation.get_sliver().get_type() != req_sliver.get_type():
Expand Down

0 comments on commit bb48904

Please sign in to comment.