function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def get_flavor(self, flavor_id):
return self.api_get('/flavors/%s' % flavor_id).body['flavor'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def post_flavor(self, flavor):
return self.api_post('/flavors', flavor).body['flavor'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def post_extra_spec(self, flavor_id, spec):
return self.api_post('/flavors/%s/os-extra_specs' %
flavor_id, spec) | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def get_volumes(self, detail=True):
rel_url = '/os-volumes/detail' if detail else '/os-volumes'
return self.api_get(rel_url).body['volumes'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def delete_volume(self, volume_id):
return self.api_delete('/os-volumes/%s' % volume_id) | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def get_snapshots(self, detail=True):
rel_url = '/os-snapshots/detail' if detail else '/os-snapshots'
return self.api_get(rel_url).body['snapshots'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def delete_snapshot(self, snap_id):
return self.api_delete('/os-snapshots/%s' % snap_id) | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def get_server_volumes(self, server_id):
return self.api_get('/servers/%s/os-volume_attachments' %
(server_id)).body['volumeAttachments'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def delete_server_volume(self, server_id, attachment_id):
return self.api_delete('/servers/%s/os-volume_attachments/%s' %
(server_id, attachment_id)) | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def get_server_groups(self, all_projects=None):
if all_projects:
return self.api_get(
'/os-server-groups?all_projects').body['server_groups']
else:
return self.api_get('/os-server-groups').body['server_groups'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def post_server_groups(self, group):
response = self.api_post('/os-server-groups', {"server_group": group})
return response.body['server_group'] | cernops/nova | [
5,
2,
5,
2,
1418819480
] |
def resource_setup(cls):
super(CrossdomainTest, cls).resource_setup()
cls.xml_start = '<?xml version="1.0"?>\n' \
'<!DOCTYPE cross-domain-policy SYSTEM ' \
'"http://www.adobe.com/xml/dtds/cross-domain-policy.' \
'dtd" >\n<cross-domain-policy>\n'
cls.xml_end = "</cross-domain-policy>" | cisco-openstack/tempest | [
2,
2,
2,
1,
1410968777
] |
def __init__(self, width, num_classes,
variant='ResNet50',
which_norm='BatchNorm', norm_kwargs=None,
activation='relu', drop_rate=0.0,
fc_init=jnp.zeros, conv_kwargs=None,
preactivation=True, use_se=False, se_ratio=0.25,
name='ResNet'):
super().__init__(name=name)
self.width = width
self.num_classes = num_classes
self.variant = variant
self.depth_pattern = self.variant_dict[variant]['depth']
self.activation = getattr(jax.nn, activation)
self.drop_rate = drop_rate
self.which_norm = getattr(hk, which_norm)
if norm_kwargs is not None:
self.which_norm = functools.partial(self.which_norm, **norm_kwargs)
if conv_kwargs is not None:
self.which_conv = functools.partial(hk.Conv2D, **conv_kwargs)
else:
self.which_conv = hk.Conv2D
self.preactivation = preactivation
# Stem
self.initial_conv = self.which_conv(16 * self.width, kernel_shape=7,
stride=2, padding='SAME',
with_bias=False, name='initial_conv')
if not self.preactivation:
self.initial_bn = self.which_norm(name='initial_bn')
which_block = ResBlockV2 if self.preactivation else ResBlockV1
# Body
self.blocks = []
for multiplier, blocks_per_stage, stride in zip([64, 128, 256, 512],
self.depth_pattern,
[1, 2, 2, 2]):
for block_index in range(blocks_per_stage):
self.blocks += [which_block(multiplier * self.width,
use_projection=block_index == 0,
stride=stride if block_index == 0 else 1,
activation=self.activation,
which_norm=self.which_norm,
which_conv=self.which_conv,
use_se=use_se,
se_ratio=se_ratio)]
# Head
self.final_bn = self.which_norm(name='final_bn')
self.fc = hk.Linear(self.num_classes, w_init=fc_init, with_bias=True) | deepmind/deepmind-research | [
11519,
2366,
11519,
161,
1547546053
] |
def __init__(self, out_ch, stride=1, use_projection=False,
activation=jax.nn.relu, which_norm=hk.BatchNorm,
which_conv=hk.Conv2D, use_se=False, se_ratio=0.25,
name=None):
super().__init__(name=name)
self.out_ch = out_ch
self.stride = stride
self.use_projection = use_projection
self.activation = activation
self.which_norm = which_norm
self.which_conv = which_conv
self.use_se = use_se
self.se_ratio = se_ratio
self.width = self.out_ch // 4
self.bn0 = which_norm(name='bn0')
self.conv0 = which_conv(self.width, kernel_shape=1, with_bias=False,
padding='SAME', name='conv0')
self.bn1 = which_norm(name='bn1')
self.conv1 = which_conv(self.width, stride=self.stride,
kernel_shape=3, with_bias=False,
padding='SAME', name='conv1')
self.bn2 = which_norm(name='bn2')
self.conv2 = which_conv(self.out_ch, kernel_shape=1, with_bias=False,
padding='SAME', name='conv2')
if self.use_projection:
self.conv_shortcut = which_conv(self.out_ch, stride=stride,
kernel_shape=1, with_bias=False,
padding='SAME', name='conv_shortcut')
if self.use_se:
self.se = base.SqueezeExcite(self.out_ch, self.out_ch, self.se_ratio) | deepmind/deepmind-research | [
11519,
2366,
11519,
161,
1547546053
] |
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--expected",
"-e",
dest="expected",
type=str,
default="",
help="Comma separated list of frameworks to expect.\n"
"Will fail if any of these are not found",
)
return parser.parse_args() | Yelp/paasta | [
1644,
229,
1644,
129,
1445895353
] |
def __init__(self, outputs, inputs, schema, rng):
"""Initialize the CGpm.
Parameters
----------
outputs : list<int>
List of endogenous variables whose joint distribution is modeled by
the CGpm. The CGpm is required to simulate and evaluate the log
density of an arbitrary susbet of output variables, by marginalizing
and/or conditioning on another (disjoint) subset of output
variables.
inputs : list<int>, optional
List of exogenous variables unmodeled by the CGpm which are needed
on a per-row basis. A full realization of all inputs (if any)
is required for each simulate and logpdf query.
schema : **kwargs
An arbitrary data structure used by the CGpm to initialize itself.
Often contains information about hyperparameters, parameters,
sufficient statistics, configuration settings, or metadata about
the input variables.
rng : numpy.random.RandomState
Source of entropy.
"""
raise NotImplementedError | probcomp/cgpm | [
24,
9,
24,
42,
1452100613
] |
def unincorporate(self, rowid):
"""Remove all incorporated observations of `rowid` from the dataset."""
raise NotImplementedError | probcomp/cgpm | [
24,
9,
24,
42,
1452100613
] |
def simulate(self, rowid, query, constraints=None, inputs=None, N=None):
"""Return N iid samples of `targets` given `constraints` and `inputs`.
(X_1, X_2, ... X_N) ~iid Pr[targets | constraints; inputs]
rowid : int, or None to indicate a hypothetical row
Specifies the identity of the population member whose posterior
distribution over unobserved outputs to simulate from.
query : list<int>
List of `output` variables to simulate. If `rowid` corresponds to an
existing member, it is an error for `targets` to contain any output
variable for that `rowid` which has already been incorporated.
constraints : dict{int:value}, optional
The keys of `constraints` must be a subset of the `output`
variables, and disjoint from the keys of `targets`. These
constraints serve as probabilistic conditions on the multivariate
output distribution. If `rowid` corresponds to an existing member,
it is an error for `constraints` to contain any output variable for
that `rowid` which has already been incorporated.
inputs : dict{int:value}, optional
The keys of `inputs` must contain all the cgpm's `input` variables,
if any. These values comprise a full realization of all exogenous
variables required by the cgpm. If `rowid` corresponds to an
existing member, then `inputs` is expected to be None.
N : int, (optional, default None)
Number of samples to return. If None, returns a single sample as
a dictionary with size len(query), where each key is an `output`
variable and each value the sample for that dimension. If `N` is
is not None, a size N list of dictionaries will be returned, each
corresponding to a single sample.
"""
raise NotImplementedError | probcomp/cgpm | [
24,
9,
24,
42,
1452100613
] |
def transition(self, **kwargs):
"""Apply an inference operator transitioning the internal state of CGpm.
**kwargs : arbitrary keyword arguments Opaque binary parsed by the CGpm
to apply inference over its latents. There are no restrictions on
the learning mechanism, which may be based on optimization
(variational inference, maximum likelihood, EM, etc), Markov chain
Monte Carlo sampling (SMC, MH, etc), arbitrary heuristics, or
others.
"""
raise NotImplementedError | probcomp/cgpm | [
24,
9,
24,
42,
1452100613
] |
def save_model(self, request, obj, form, change):
# TODO do this sync async (give celery another shot?)
obj.save()
obj.fetch_all() | texastribune/wjordpress | [
8,
1,
8,
5,
1405381508
] |
def hook(self, obj):
"""
This is where an admin can find what url to point the webhook to.
Doing it as an absolute url lets us cheat and make the browser figure
out the host for us.
Requires HookPress: http://wordpress.org/plugins/hookpress/
"""
try:
return (u'<a href="{}" title="Add a save_post hook with the ID">'
'Webhook</a>'.format(obj.hook_url))
except NoReverseMatch:
return '' | texastribune/wjordpress | [
8,
1,
8,
5,
1405381508
] |
def __init__(cls, what, bases=None, dict=None):
super().__init__(what, bases, dict)
cls.process() | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __len__(self):
return len(self._members) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __call__(self, value, default=_no_default):
"""Instantiating an Enum always produces an existing value or throws an exception."""
return self.parse(value, default=default) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def _make_value(self, value):
"""Instantiates an enum with an arbitrary value."""
member = self.__new__(self, value)
member.__init__(value)
return member | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __prepare__(cls, name, bases, **kwargs):
return {} | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __init__(self, value):
self.value = int(value) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def short_name(self):
"""Returns the enum member's name, like "foo"."""
raise NotImplementedError | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def long_name(self):
"""Returns the enum member's name including the class name, like "MyEnum.foo"."""
return "%s.%s" % (self.__class__.__name__, self.short_name) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def title(self):
"""Returns the enum member's name in title case, like "FooBar" for MyEnum.foo_bar."""
return self.short_name.replace("_", " ").title() | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def full_name(self):
"""Returns the enum meber's name including the module, like "mymodule.MyEnum.foo"."""
return "%s.%s" % (self.__class__.__module__, self.long_name) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def assert_valid(self):
if not self.is_valid():
raise _create_invalid_value_error(self.__class__, self.value) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __call__(self):
return self.value | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __ne__(self, other):
return self.value != other | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __str__(self):
if self.is_valid():
return self.short_name
else:
return "%s(%s)" % (self.__class__.__name__, self.value) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def get_names(cls):
"""Returns the names of all members of this enum."""
return [m.short_name for m in cls._members] | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def get_members(cls):
return cls._members | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def create(cls, name, members):
"""Creates a new enum type based on this one (cls) and adds newly
passed members to the newly created subclass of cls.
This method helps to create enums having the same member values as
values of other enum(s).
:param name: name of the newly created type
:param members: 1) a dict or 2) a list of (name, value) tuples
and/or EnumBase instances describing new members
:return: newly created enum type.
"""
NewEnum = type(name, (cls,), {})
if isinstance(members, dict):
members = members.items()
for member in members:
if isinstance(member, tuple):
name, value = member
setattr(NewEnum, name, value)
elif isinstance(member, EnumBase):
setattr(NewEnum, member.short_name, member.value)
else:
assert False, (
"members must be either a dict, "
+ "a list of (name, value) tuples, "
+ "or a list of EnumBase instances."
)
NewEnum.process()
# needed for pickling to work (hopefully); taken from the namedtuple implementation in the
# standard library
try:
NewEnum.__module__ = sys._getframe(1).f_globals.get("__name__", "__main__")
except (AttributeError, ValueError):
pass
return NewEnum | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def parse(cls, value, default=_no_default):
"""Parses a value into a member of this enum."""
raise NotImplementedError | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def is_valid(self):
return self.value in self._value_to_member | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def short_name(self):
self.assert_valid()
return self._value_to_name[self.value] | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def parse(cls, value, default=_no_default):
"""Parses an enum member name or value into an enum member.
Accepts the following types:
- Members of this enum class. These are returned directly.
- Integers. If there is an enum member with the integer as a value, that member is returned.
- Strings. If there is an enum member with the string as its name, that member is returned.
For integers and strings that don't correspond to an enum member, default is returned; if
no default is given the function raises KeyError instead.
Examples:
>>> class Color(Enum):
... red = 1
... blue = 2
>>> Color.parse(Color.red)
Color.red
>>> Color.parse(1)
Color.red
>>> Color.parse('blue')
Color.blue
"""
if isinstance(value, cls):
return value
elif isinstance(value, int) and not isinstance(value, EnumBase):
e = cls._value_to_member.get(value, _no_default)
else:
e = cls._name_to_member.get(value, _no_default)
if e is _no_default or not e.is_valid():
if default is _no_default:
raise _create_invalid_value_error(cls, value)
return default
return e | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def is_valid(self):
value = self.value
for v in self._flag_values:
if (v | value) == value:
value ^= v
return value == 0 | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def short_name(self):
self.assert_valid()
result = []
l = self.value
for v in self._flag_values:
if (v | l) == l:
l ^= v
result.append(self._value_to_name[v])
if not result:
if 0 in self._value_to_name:
return self._value_to_name[0]
else:
return ""
return ",".join(result) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def parse(cls, value, default=_no_default):
"""Parses a flag integer or string into a Flags instance.
Accepts the following types:
- Members of this enum class. These are returned directly.
- Integers. These are converted directly into a Flags instance with the given name.
- Strings. The function accepts a comma-delimited list of flag names, corresponding to
members of the enum. These are all ORed together.
Examples:
>>> class Car(Flags):
... is_big = 1
... has_wheels = 2
>>> Car.parse(1)
Car.is_big
>>> Car.parse(3)
Car.parse('has_wheels,is_big')
>>> Car.parse('is_big,has_wheels')
Car.parse('has_wheels,is_big')
"""
if isinstance(value, cls):
return value
elif isinstance(value, int):
e = cls._make_value(value)
else:
if not value:
e = cls._make_value(0)
else:
r = 0
for k in value.split(","):
v = cls._name_to_member.get(k, _no_default)
if v is _no_default:
if default is _no_default:
raise _create_invalid_value_error(cls, value)
else:
return default
r |= v.value
e = cls._make_value(r)
if not e.is_valid():
if default is _no_default:
raise _create_invalid_value_error(cls, value)
return default
return e | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __or__(self, other):
return self.__class__(self.value | int(other)) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __xor__(self, other):
return self.__class__(self.value ^ int(other)) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __repr__(self):
return Enum.__repr__(self) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __init__(self, start=1):
self._next_value = start | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def next(self):
result = self._next_value
self._next_value += 1
return result | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self._next_value) | quora/qcore | [
85,
18,
85,
5,
1468262070
] |
def update(self):
for index, line in self.update_json():
self.analyze(line) | yeti-platform/yeti | [
1360,
268,
1360,
132,
1450025666
] |
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=True)
self.__key_server_priority = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(16), is_leaf=True, yang_name="key-server-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint8', is_config=True)
self.__macsec_cipher_suite = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=True)
self.__confidentiality_offset = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'0_BYTES': {}, '30_BYTES': {}, '50_BYTES': {}},), default=six.text_type("0_BYTES"), is_leaf=True, yang_name="confidentiality-offset", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:confidentiality-offset', is_config=True)
self.__delay_protection = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="delay-protection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)
self.__include_icv_indicator = YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="include-icv-indicator", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)
self.__sak_rekey_interval = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0', '30..65535']}), default=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32)(0), is_leaf=True, yang_name="sak-rekey-interval", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint32', is_config=True)
self.__sak_rekey_on_live_peer_loss = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)
self.__use_updated_eth_header = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="use-updated-eth-header", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_name(self):
"""
Getter method for name, mapped from YANG variable /macsec/mka/policies/policy/config/name (string)
YANG Description: Name of the MKA policy.
"""
return self.__name | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_name(self, v, load=False):
"""
Setter method for name, mapped from YANG variable /macsec/mka/policies/policy/config/name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_name() directly.
YANG Description: Name of the MKA policy.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """name must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=True)""",
})
self.__name = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_key_server_priority(self):
"""
Getter method for key_server_priority, mapped from YANG variable /macsec/mka/policies/policy/config/key_server_priority (uint8)
YANG Description: Specifies the key server priority used by the MACsec Key Agreement | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_key_server_priority(self, v, load=False):
"""
Setter method for key_server_priority, mapped from YANG variable /macsec/mka/policies/policy/config/key_server_priority (uint8)
If this variable is read-only (config: false) in the
source YANG file, then _set_key_server_priority is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_key_server_priority() directly.
YANG Description: Specifies the key server priority used by the MACsec Key Agreement | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_key_server_priority(self):
self.__key_server_priority = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(16), is_leaf=True, yang_name="key-server-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint8', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_macsec_cipher_suite(self, v, load=False):
"""
Setter method for macsec_cipher_suite, mapped from YANG variable /macsec/mka/policies/policy/config/macsec_cipher_suite (macsec-types:macsec-cipher-suite)
If this variable is read-only (config: false) in the
source YANG file, then _set_macsec_cipher_suite is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_macsec_cipher_suite() directly.
YANG Description: Set Cipher suite(s) for SAK derivation
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """macsec_cipher_suite must be of a type compatible with macsec-types:macsec-cipher-suite""",
'defined-type': "macsec-types:macsec-cipher-suite",
'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=True)""",
})
self.__macsec_cipher_suite = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_confidentiality_offset(self):
"""
Getter method for confidentiality_offset, mapped from YANG variable /macsec/mka/policies/policy/config/confidentiality_offset (macsec-types:confidentiality-offset)
YANG Description: The confidentiality offset specifies a number of octets in an Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_confidentiality_offset(self, v, load=False):
"""
Setter method for confidentiality_offset, mapped from YANG variable /macsec/mka/policies/policy/config/confidentiality_offset (macsec-types:confidentiality-offset)
If this variable is read-only (config: false) in the
source YANG file, then _set_confidentiality_offset is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_confidentiality_offset() directly.
YANG Description: The confidentiality offset specifies a number of octets in an Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_confidentiality_offset(self):
self.__confidentiality_offset = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'0_BYTES': {}, '30_BYTES': {}, '50_BYTES': {}},), default=six.text_type("0_BYTES"), is_leaf=True, yang_name="confidentiality-offset", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:confidentiality-offset', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_delay_protection(self, v, load=False):
"""
Setter method for delay_protection, mapped from YANG variable /macsec/mka/policies/policy/config/delay_protection (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_delay_protection is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_delay_protection() directly.
YANG Description: Traffic delayed longer than 2 seconds is rejected by the interfaces | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_delay_protection(self):
self.__delay_protection = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="delay-protection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_include_icv_indicator(self, v, load=False):
"""
Setter method for include_icv_indicator, mapped from YANG variable /macsec/mka/policies/policy/config/include_icv_indicator (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_include_icv_indicator is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_include_icv_indicator() directly.
YANG Description: Generate and include an Integrity Check Value (ICV) field in the MKPDU. | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_include_icv_indicator(self):
self.__include_icv_indicator = YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="include-icv-indicator", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_sak_rekey_interval(self, v, load=False):
"""
Setter method for sak_rekey_interval, mapped from YANG variable /macsec/mka/policies/policy/config/sak_rekey_interval (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_sak_rekey_interval is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_sak_rekey_interval() directly.
YANG Description: SAK Rekey interval in seconds. The default value is 0 where no rekey is | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_sak_rekey_interval(self):
self.__sak_rekey_interval = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0', '30..65535']}), default=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32)(0), is_leaf=True, yang_name="sak-rekey-interval", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint32', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_sak_rekey_on_live_peer_loss(self, v, load=False):
"""
Setter method for sak_rekey_on_live_peer_loss, mapped from YANG variable /macsec/mka/policies/policy/config/sak_rekey_on_live_peer_loss (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_sak_rekey_on_live_peer_loss is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_sak_rekey_on_live_peer_loss() directly.
YANG Description: Rekey on peer loss
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """sak_rekey_on_live_peer_loss must be of a type compatible with boolean""",
'defined-type': "boolean",
'generated-type': """YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True)""",
})
self.__sak_rekey_on_live_peer_loss = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_use_updated_eth_header(self):
"""
Getter method for use_updated_eth_header, mapped from YANG variable /macsec/mka/policies/policy/config/use_updated_eth_header (boolean)
YANG Description: Use updated ethernet header for ICV calculation. In case the Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_use_updated_eth_header(self, v, load=False):
"""
Setter method for use_updated_eth_header, mapped from YANG variable /macsec/mka/policies/policy/config/use_updated_eth_header (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_use_updated_eth_header is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_use_updated_eth_header() directly.
YANG Description: Use updated ethernet header for ICV calculation. In case the Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_use_updated_eth_header(self):
self.__use_updated_eth_header = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="use-updated-eth-header", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=True) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=False)
self.__key_server_priority = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(16), is_leaf=True, yang_name="key-server-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint8', is_config=False)
self.__macsec_cipher_suite = YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=False)
self.__confidentiality_offset = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'0_BYTES': {}, '30_BYTES': {}, '50_BYTES': {}},), default=six.text_type("0_BYTES"), is_leaf=True, yang_name="confidentiality-offset", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:confidentiality-offset', is_config=False)
self.__delay_protection = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="delay-protection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)
self.__include_icv_indicator = YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="include-icv-indicator", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)
self.__sak_rekey_interval = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0', '30..65535']}), default=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32)(0), is_leaf=True, yang_name="sak-rekey-interval", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint32', is_config=False)
self.__sak_rekey_on_live_peer_loss = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)
self.__use_updated_eth_header = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="use-updated-eth-header", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_name(self):
"""
Getter method for name, mapped from YANG variable /macsec/mka/policies/policy/state/name (string)
YANG Description: Name of the MKA policy.
"""
return self.__name | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_name(self, v, load=False):
"""
Setter method for name, mapped from YANG variable /macsec/mka/policies/policy/state/name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_name() directly.
YANG Description: Name of the MKA policy.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """name must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='string', is_config=False)""",
})
self.__name = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_key_server_priority(self):
"""
Getter method for key_server_priority, mapped from YANG variable /macsec/mka/policies/policy/state/key_server_priority (uint8)
YANG Description: Specifies the key server priority used by the MACsec Key Agreement | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_key_server_priority(self, v, load=False):
"""
Setter method for key_server_priority, mapped from YANG variable /macsec/mka/policies/policy/state/key_server_priority (uint8)
If this variable is read-only (config: false) in the
source YANG file, then _set_key_server_priority is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_key_server_priority() directly.
YANG Description: Specifies the key server priority used by the MACsec Key Agreement | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_key_server_priority(self):
self.__key_server_priority = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), default=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8)(16), is_leaf=True, yang_name="key-server-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint8', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_macsec_cipher_suite(self, v, load=False):
"""
Setter method for macsec_cipher_suite, mapped from YANG variable /macsec/mka/policies/policy/state/macsec_cipher_suite (macsec-types:macsec-cipher-suite)
If this variable is read-only (config: false) in the
source YANG file, then _set_macsec_cipher_suite is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_macsec_cipher_suite() directly.
YANG Description: Set Cipher suite(s) for SAK derivation
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """macsec_cipher_suite must be of a type compatible with macsec-types:macsec-cipher-suite""",
'defined-type': "macsec-types:macsec-cipher-suite",
'generated-type': """YANGDynClass(unique=True, base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'GCM_AES_128': {}, 'GCM_AES_256': {}, 'GCM_AES_XPN_128': {}, 'GCM_AES_XPN_256': {}},)), is_leaf=False, yang_name="macsec-cipher-suite", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:macsec-cipher-suite', is_config=False)""",
})
self.__macsec_cipher_suite = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_confidentiality_offset(self):
"""
Getter method for confidentiality_offset, mapped from YANG variable /macsec/mka/policies/policy/state/confidentiality_offset (macsec-types:confidentiality-offset)
YANG Description: The confidentiality offset specifies a number of octets in an Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_confidentiality_offset(self, v, load=False):
"""
Setter method for confidentiality_offset, mapped from YANG variable /macsec/mka/policies/policy/state/confidentiality_offset (macsec-types:confidentiality-offset)
If this variable is read-only (config: false) in the
source YANG file, then _set_confidentiality_offset is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_confidentiality_offset() directly.
YANG Description: The confidentiality offset specifies a number of octets in an Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_confidentiality_offset(self):
self.__confidentiality_offset = YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'0_BYTES': {}, '30_BYTES': {}, '50_BYTES': {}},), default=six.text_type("0_BYTES"), is_leaf=True, yang_name="confidentiality-offset", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='macsec-types:confidentiality-offset', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_delay_protection(self, v, load=False):
"""
Setter method for delay_protection, mapped from YANG variable /macsec/mka/policies/policy/state/delay_protection (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_delay_protection is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_delay_protection() directly.
YANG Description: Traffic delayed longer than 2 seconds is rejected by the interfaces | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_delay_protection(self):
self.__delay_protection = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="delay-protection", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_include_icv_indicator(self, v, load=False):
"""
Setter method for include_icv_indicator, mapped from YANG variable /macsec/mka/policies/policy/state/include_icv_indicator (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_include_icv_indicator is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_include_icv_indicator() directly.
YANG Description: Generate and include an Integrity Check Value (ICV) field in the MKPDU. | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_include_icv_indicator(self):
self.__include_icv_indicator = YANGDynClass(base=YANGBool, default=YANGBool("true"), is_leaf=True, yang_name="include-icv-indicator", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_sak_rekey_interval(self, v, load=False):
"""
Setter method for sak_rekey_interval, mapped from YANG variable /macsec/mka/policies/policy/state/sak_rekey_interval (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_sak_rekey_interval is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_sak_rekey_interval() directly.
YANG Description: SAK Rekey interval in seconds. The default value is 0 where no rekey is | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_sak_rekey_interval(self):
self.__sak_rekey_interval = YANGDynClass(base=RestrictedClassType(base_type=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), restriction_dict={'range': ['0', '30..65535']}), default=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32)(0), is_leaf=True, yang_name="sak-rekey-interval", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='uint32', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_sak_rekey_on_live_peer_loss(self, v, load=False):
"""
Setter method for sak_rekey_on_live_peer_loss, mapped from YANG variable /macsec/mka/policies/policy/state/sak_rekey_on_live_peer_loss (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_sak_rekey_on_live_peer_loss is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_sak_rekey_on_live_peer_loss() directly.
YANG Description: Rekey on peer loss
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """sak_rekey_on_live_peer_loss must be of a type compatible with boolean""",
'defined-type': "boolean",
'generated-type': """YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="sak-rekey-on-live-peer-loss", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False)""",
})
self.__sak_rekey_on_live_peer_loss = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_use_updated_eth_header(self):
"""
Getter method for use_updated_eth_header, mapped from YANG variable /macsec/mka/policies/policy/state/use_updated_eth_header (boolean)
YANG Description: Use updated ethernet header for ICV calculation. In case the Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_use_updated_eth_header(self, v, load=False):
"""
Setter method for use_updated_eth_header, mapped from YANG variable /macsec/mka/policies/policy/state/use_updated_eth_header (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_use_updated_eth_header is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_use_updated_eth_header() directly.
YANG Description: Use updated ethernet header for ICV calculation. In case the Ethernet | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _unset_use_updated_eth_header(self):
self.__use_updated_eth_header = YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="use-updated-eth-header", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='boolean', is_config=False) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__name = YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='leafref', is_config=True)
self.__config = YANGDynClass(base=yc_config_openconfig_macsec__macsec_mka_policies_policy_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)
self.__state = YANGDynClass(base=yc_state_openconfig_macsec__macsec_mka_policies_policy_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_name(self):
"""
Getter method for name, mapped from YANG variable /macsec/mka/policies/policy/name (leafref)
YANG Description: Reference to MKA policy name
"""
return self.__name | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_name(self, v, load=False):
"""
Setter method for name, mapped from YANG variable /macsec/mka/policies/policy/name (leafref)
If this variable is read-only (config: false) in the
source YANG file, then _set_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_name() directly.
YANG Description: Reference to MKA policy name
"""
parent = getattr(self, "_parent", None)
if parent is not None and load is False:
raise AttributeError("Cannot set keys directly when" +
" within an instantiated list")
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='leafref', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """name must be of a type compatible with leafref""",
'defined-type': "leafref",
'generated-type': """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='leafref', is_config=True)""",
})
self.__name = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_config(self):
"""
Getter method for config, mapped from YANG variable /macsec/mka/policies/policy/config (container)
YANG Description: Configuration of the MKA policy
"""
return self.__config | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_config(self, v, load=False):
"""
Setter method for config, mapped from YANG variable /macsec/mka/policies/policy/config (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_config is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_config() directly.
YANG Description: Configuration of the MKA policy
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=yc_config_openconfig_macsec__macsec_mka_policies_policy_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """config must be of a type compatible with container""",
'defined-type': "container",
'generated-type': """YANGDynClass(base=yc_config_openconfig_macsec__macsec_mka_policies_policy_config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)""",
})
self.__config = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _get_state(self):
"""
Getter method for state, mapped from YANG variable /macsec/mka/policies/policy/state (container)
YANG Description: Operational state data for MKA policy
"""
return self.__state | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def _set_state(self, v, load=False):
"""
Setter method for state, mapped from YANG variable /macsec/mka/policies/policy/state (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_state is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_state() directly.
YANG Description: Operational state data for MKA policy
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=yc_state_openconfig_macsec__macsec_mka_policies_policy_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """state must be of a type compatible with container""",
'defined-type': "container",
'generated-type': """YANGDynClass(base=yc_state_openconfig_macsec__macsec_mka_policies_policy_state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='container', is_config=True)""",
})
self.__state = t
if hasattr(self, '_set'):
self._set() | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
def __init__(self, *args, **kwargs):
self._path_helper = False
self._extmethods = False
self.__policy = YANGDynClass(base=YANGListType("name",yc_policy_openconfig_macsec__macsec_mka_policies_policy, yang_name="policy", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="policy", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/macsec', defining_module='openconfig-macsec', yang_type='list', is_config=True)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load) | google/gnxi | [
229,
110,
229,
19,
1506413981
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.