Skip to content

Commit 195d6e7

Browse files
authored
Merge pull request #395 from fabric-testbed/rel1.7
Rel1.7 - changes
2 parents be2e7b5 + 908add7 commit 195d6e7

File tree

93 files changed

+3898
-956
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3898
-956
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,8 @@ fabric_cf/actor/test/*.graphml
150150
secrets/kafkacat2-ca1-signed.pem
151151
secrets/kafkacat1-ca1-signed.pem
152152
secrets/...
153+
neo4j/RENC.graphml
154+
neo4j/Network-dev.graphml
155+
.DS_Store
156+
*.log*
157+
*.avsc

Dockerfile-auth

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:3.11.0
22
MAINTAINER Komal Thareja<[email protected]>
33

4-
ARG HANDLERS_VER=1.6.3
4+
ARG HANDLERS_VER=1.7.1
55

66
RUN mkdir -p /usr/src/app
77
WORKDIR /usr/src/app
@@ -11,6 +11,7 @@ EXPOSE 11000
1111

1212
RUN apt-get update
1313
RUN apt-get install cron -y
14+
RUN apt-get install sshpass -y
1415

1516
COPY docker-entrypoint.sh /usr/src/app/
1617
COPY fabric_cf /usr/src/app/fabric_cf

fabric_cf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "1.6.2"
1+
__version__ = "1.7.0"
22
__VERSION__ = __version__

fabric_cf/actor/core/apis/abc_actor_container.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,12 @@ def remove_actor_database(self, *, actor_name: str):
152152
Remove Actor Database
153153
@params actor_name: actor name
154154
"""
155+
156+
@abstractmethod
157+
def get_actor(self) -> ABCActorMixin:
158+
"""
159+
Return Actor
160+
161+
@return Actor
162+
"""
163+
pass

fabric_cf/actor/core/apis/abc_actor_management_object.py

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from __future__ import annotations
2727

2828
from abc import abstractmethod
29+
from datetime import datetime
2930
from typing import TYPE_CHECKING, Tuple, Dict, List
3031

31-
from fabric_mb.message_bus.messages.poa_avro import PoaAvro
3232
from fabric_mb.message_bus.messages.result_avro import ResultAvro
3333
from fabric_mb.message_bus.messages.result_delegation_avro import ResultDelegationAvro
3434
from fabric_mb.message_bus.messages.result_poa_avro import ResultPoaAvro
@@ -38,6 +38,7 @@
3838
from fabric_mb.message_bus.messages.result_slice_avro import ResultSliceAvro
3939
from fabric_mb.message_bus.messages.result_string_avro import ResultStringAvro
4040
from fabric_mb.message_bus.messages.slice_avro import SliceAvro
41+
from fim.user import GraphFormat
4142

4243
from fabric_cf.actor.core.apis.abc_management_object import ABCManagementObject
4344
from fabric_cf.actor.core.container.maintenance import Site
@@ -237,7 +238,8 @@ def get_sites(self, *, caller: AuthToken, site: str) -> ResultSitesAvro:
237238
def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
238239
slice_id: ID = None, rid: ID = None, oidc_claim_sub: str = None,
239240
email: str = None, rid_list: List[str] = None, type: str = None,
240-
site: str = None, node_id: str = None) -> ResultReservationAvro:
241+
site: str = None, node_id: str = None,
242+
host: str = None, ip_subnet: str = None) -> ResultReservationAvro:
241243
"""
242244
Get Reservations
243245
@param states states
@@ -251,12 +253,16 @@ def get_reservations(self, *, caller: AuthToken, states: List[int] = None,
251253
@param node_id node id
252254
Obtains all reservations with error information in case of failure
253255
@param caller caller
256+
@param host host
257+
@param ip_subnet ip subnet
258+
254259
@return returns list of the reservations
255260
"""
256261

257262
def get_slices(self, *, slice_id: ID, caller: AuthToken, slice_name: str = None, email: str = None,
258263
states: List[int] = None, project: str = None, limit: int = None,
259-
offset: int = None, user_id: str = None) -> ResultSliceAvro:
264+
offset: int = None, user_id: str = None, search: str = None,
265+
exact_match: bool = False) -> ResultSliceAvro:
260266
"""
261267
Obtains all slices.
262268
@param slice_id slice id
@@ -268,13 +274,73 @@ def get_slices(self, *, slice_id: ID, caller: AuthToken, slice_name: str = None,
268274
@param offset offset
269275
@param caller caller
270276
@param user_id user_id
277+
@param search: search term applied
278+
@param exact_match: Exact Match for Search term
271279
@return returns list of slices
272280
"""
273281

282+
@abstractmethod
283+
def increment_metrics(self, *, project_id: str, oidc_sub: str, slice_count: int = 1) -> bool:
284+
"""
285+
Add or update metrics
286+
287+
@param project_id project id
288+
@param oidc_sub oidc sub
289+
@param slice_count slice_count
290+
291+
@return true or false
292+
293+
@throws Exception in case of error
294+
"""
295+
296+
@abstractmethod
297+
def get_metrics(self, *, project_id: str, oidc_sub: str, excluded_projects: List[str] = None) -> list:
298+
"""
299+
Get metrics
300+
301+
@param project_id project id
302+
@param oidc_sub oidc sub
303+
@param excluded_projects excluded_projects
304+
305+
@return list of metric information
306+
307+
@throws Exception in case of error
308+
"""
309+
310+
def get_slice_count(self, *, caller: AuthToken, email: str = None, states: List[int] = None,
311+
project: str = None, user_id: str = None, excluded_projects: List[str] = None) -> int:
312+
"""
313+
Obtains Slice count matching the filter criteria.
314+
315+
@param email email
316+
@param project project id
317+
@param states slice states
318+
@param caller caller
319+
@param user_id user_id
320+
@param excluded_projects excluded_projects
321+
@return returns number of slices
322+
"""
323+
274324
def remove_slice(self, *, slice_id: ID, caller: AuthToken) -> ResultAvro:
275325
"""
276326
Removes the specified slice
277327
@param slice_id slice id
278328
@param caller caller
279329
@return true for success; false otherwise
330+
"""
331+
332+
def build_broker_query_model(self, level_0_broker_query_model: str, level: int,
333+
graph_format: GraphFormat = GraphFormat.GRAPHML,
334+
start: datetime = None, end: datetime = None, includes: str = None,
335+
excludes: str = None) -> str:
336+
"""
337+
Build the BQM Model using current usage
338+
@param level_0_broker_query_model Capacity Model
339+
@param level: level of details
340+
@param graph_format: Graph Format
341+
@param start: start time
342+
@param end: end time
343+
@param includes: comma separated lists of sites to include
344+
@param excludes: comma separated lists of sites to exclude
345+
@return BQM
280346
"""

fabric_cf/actor/core/apis/abc_actor_mixin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from fabric_cf.actor.core.apis.abc_tick import ABCTick
3939

4040
if TYPE_CHECKING:
41+
from fabric_cf.actor.core.kernel.slice_state_machine import SliceState
4142
from fabric_cf.actor.core.apis.abc_actor_event import ABCActorEvent
4243
from fabric_cf.actor.core.apis.abc_actor_proxy import ABCActorProxy
4344
from fabric_cf.actor.core.apis.abc_base_plugin import ABCBasePlugin
@@ -431,12 +432,13 @@ def register_slice(self, *, slice_object: ABCSlice):
431432
"""
432433

433434
@abstractmethod
434-
def modify_slice(self, *, slice_object: ABCSlice):
435+
def modify_slice(self, *, slice_object: ABCSlice, new_state: SliceState):
435436
"""
436437
Modify the slice registered with the actor. Moves the slice into Modifying State
437438
438439
Args:
439440
slice_object: slice_object
441+
new_state: new_state
440442
Raises:
441443
Exception in case of error
442444
"""

fabric_cf/actor/core/apis/abc_client_actor_management_object.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,22 @@ def update_broker(self, *, broker: ProxyAvro, caller: AuthToken) -> ResultAvro:
128128

129129
@abstractmethod
130130
def get_broker_query_model(self, *, broker: ID, caller: AuthToken, id_token: str,
131-
level: int, graph_format: GraphFormat) -> ResultBrokerQueryModelAvro:
131+
level: int, graph_format: GraphFormat, start: datetime = None,
132+
end: datetime = None, includes: str = None,
133+
excludes: str = None) -> ResultBrokerQueryModelAvro:
132134
"""
133135
Get Pool Info
134136
@param broker : broker ID
135137
@param caller: caller
136138
@param id_token: str
137139
@param level: level of details
138140
@param graph_format: Graph Format
139-
@return pool information
141+
@param start: start time
142+
@param end: end time
143+
@param includes: comma separated lists of sites to include
144+
@param excludes: comma separated lists of sites to exclude
145+
146+
@return resource information
140147
"""
141148

142149
@abstractmethod

fabric_cf/actor/core/apis/abc_database.py

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ def update_slice(self, *, slice_object: ABCSlice):
159159

160160
@abstractmethod
161161
def get_reservations(self, *, slice_id: ID = None, graph_node_id: str = None, project_id: str = None,
162-
email: str = None, oidc_sub: str = None, rid: ID = None,
163-
states: list[int] = None, site: str = None,
164-
rsv_type: list[str] = None) -> List[ABCReservationMixin]:
162+
email: str = None, oidc_sub: str = None, rid: ID = None, states: list[int] = None,
163+
site: str = None, rsv_type: list[str] = None, start: datetime = None,
164+
end: datetime = None, ip_subnet: str = None, host: str = None) -> List[ABCReservationMixin]:
165165
"""
166166
Retrieves the reservations.
167167
@@ -172,13 +172,22 @@ def get_reservations(self, *, slice_id: ID = None, graph_node_id: str = None, pr
172172

173173
@abstractmethod
174174
def get_components(self, *, node_id: str, states: list[int], rsv_type: list[str], component: str = None,
175-
bdf: str = None) -> Dict[str, List[str]]:
175+
bdf: str = None, start: datetime = None, end: datetime = None,
176+
excludes: List[str] = None) -> Dict[str, List[str]]:
176177
"""
177-
Retrieves the components.
178+
Returns components matching the search criteria
179+
@param node_id: Worker Node ID to which components belong
180+
@param states: list of states used to find reservations
181+
@param rsv_type: type of reservations
182+
@param component: component name
183+
@param bdf: Component's PCI address
184+
@param start: start time
185+
@param end: end time
186+
@param excludes: Excludes the list of reservations
178187
179-
@return list of components
188+
NOTE# For P4 switches; node_id=node+renc-p4-sw component=ip+192.168.11.8 bdf=p1
180189
181-
@throws Exception in case of error
190+
@return Dictionary with component name as the key and value as list of associated PCI addresses in use.
182191
"""
183192

184193
@abstractmethod
@@ -194,7 +203,8 @@ def get_client_reservations(self, *, slice_id: ID = None) -> List[ABCReservation
194203
@abstractmethod
195204
def get_slices(self, *, slice_id: ID = None, slice_name: str = None, project_id: str = None, email: str = None,
196205
states: list[int] = None, oidc_sub: str = None, slc_type: List[SliceTypes] = None,
197-
limit: int = None, offset: int = None, lease_end: datetime = None) -> List[ABCSlice] or None:
206+
limit: int = None, offset: int = None, lease_end: datetime = None,
207+
search: str = None, exact_match: bool = False) -> List[ABCSlice] or None:
198208
"""
199209
Retrieves the specified slices.
200210
@@ -208,12 +218,58 @@ def get_slices(self, *, slice_id: ID = None, slice_name: str = None, project_id:
208218
@param limit limit
209219
@param offset offset
210220
@param lease_end lease_end
221+
@param search: search term applied
222+
@param exact_match: Exact Match for Search term
211223
212224
@return list of slices
213225
214226
@throws Exception in case of error
215227
"""
216228

229+
@abstractmethod
230+
def get_slice_count(self, *, project_id: str = None, email: str = None, states: list[int] = None,
231+
oidc_sub: str = None, slc_type: List[SliceTypes] = None,
232+
excluded_projects: List[str] = None) -> int:
233+
"""
234+
Retrieves the slices count.
235+
236+
@param project_id project id
237+
@param email email
238+
@param states states
239+
@param oidc_sub oidc sub
240+
@param slc_type slice type
241+
@param excluded_projects excluded_projects
242+
243+
@return number of slices matching the filter criteria
244+
245+
@throws Exception in case of error
246+
"""
247+
248+
@abstractmethod
249+
def increment_metrics(self, *, project_id: str, oidc_sub: str, slice_count: int = 1) -> bool:
250+
"""
251+
Add or Update Metrics
252+
253+
@param project_id project id
254+
@param oidc_sub oidc sub
255+
@param slice_count slice_count
256+
257+
@return true or false
258+
259+
@throws Exception in case of error
260+
"""
261+
262+
@abstractmethod
263+
def get_metrics(self, *, project_id: str, oidc_sub: str, excluded_projects: List[str] = None) -> list:
264+
"""
265+
Get Metrics
266+
@param project_id: project id
267+
@param oidc_sub: user id
268+
@param excluded_projects: list of project ids to exclude
269+
270+
@return list of metrics
271+
"""
272+
217273
@abstractmethod
218274
def initialize(self):
219275
"""

0 commit comments

Comments
 (0)