2. acg

class fwOper.acg.OBJ(obj_grp_name, _hash)[source]

Bases: fwOper.fwObj.Singulars

Individual group object

Parameters

Singulars (Singulars) – Inherits - individual object properties definitions

Raises
  • Exception – IncorrectIteminItemType

  • Exception – InvalidGroupMemberType

  • Exception – NoValidCandidate

Returns

a single object-group object

Return type

OBJ

add(*arg)[source]
add_str(header=True)[source]
del_str(header=False)[source]
delete(*arg)[source]
property grp_details

object group details in dictionary (helpful in generating copy)

Returns

object-group primary/basic details

Return type

dict

has(obj)[source]

returns object group if self contains provided object-group.

Parameters

obj (OBJ) – object-group object to check within

Returns

object-group object if self within it else None

Return type

(OBJ, None, False)

over(acls)[source]

returns dictionary of acls with acl/line/attribute if object group present in any acls

Parameters

acls (ACLS) – dictionary of all acls (ACLS)

Returns

dictionary of acls with acl/line/attribute

Return type

dict

parse()[source]

starts parsing object-group-config-lines-list and set extended variables of instance

set_instance_primary_details(obj_grp_details)[source]

set primary variable details of instance

Parameters

obj_grp_details (dict) – object-group primary/basic details (candidates-list, type, service-filter)

str()[source]

String representation of full object-group

Returns

object-group

Return type

str

class fwOper.acg.OBJS(config_list)[source]

Bases: fwOper.fwObj.Plurals

collection of object groups

Parameters

Plurals (Plurals) – Inherits - group of items properties definitions

changes(change)[source]

collate the delta changes recorded in all object-groups and provide delta for that change ( “ADDS”, “REMOVALS”)

Parameters

change (str) – type of change for which change output requested ( “ADDS”, “REMOVALS” )

Returns

delta changes

Return type

str

get_matching_obj_grps(requests)[source]

matches provided (request members) in all object-groups available on device and returns dictionary of object-group names, where object-group matches same members in it.

Parameters

requests (tuple, list, set) – list/set/tuple with members of dict, containing ‘source’, ‘destination’, ‘ports’ as keys.

Raises

Exception – Invalid Request type

Returns

include all three, src, dest, port

Return type

dict

matching_obj_grps(member)[source]

matches provided [members] in all object-groups available on device and returns list of object-group names, where object-group matches same members in it.

Parameters

member (list, set, tuple) – list/set/tuple with members

Returns

singular object

Return type

list

set_objects()[source]

set extended information of each object-group.

fwOper.acg.get_member_obj(member_type, member, objs)[source]

convert and provided string member to member object aka: Network, OBJ, Ports based on its member-type provided. objs: requires for recursive lookup for OBJ (if any)

Parameters
  • member_type (str) – type of member

  • member (str) – string repr of Network, OBJ, Ports etc

  • objs (OBJS) – collection of Object-groups (OBJS object)

Raises

Exception – InvalidMemberType

Returns

Based on member type returns member object

Return type

[Network, Ports, None]