- ssh = SSH()
- ssh.connect(self._node)
-
- # We're using this "| sudo tee" construct because redirecting
- # a sudo's output ("sudo echo xxx > /path/to/file") does not
- # work on most platforms...
- (ret, _, _) = \
- ssh.exec_command('echo "{0}" | sudo tee {1}'.
- format(self._vpp_config,
- self._vpp_config_filename))
-
- if ret != 0:
- raise RuntimeError('Writing config file failed to node {}'.
- format(self._hostname))
-
- # Instead of restarting, we'll do separate start and stop
- # actions. This way we don't care whether VPP was running
- # to begin with.
- ssh.exec_command('sudo service {} stop'
- .format(self._vpp_service_name))
- (ret, _, _) = \
- ssh.exec_command('sudo service {} start'
- .format(self._vpp_service_name))
- if ret != 0:
- raise RuntimeError('Restarting VPP failed on node {}'.
- format(self._hostname))
-
- # Sleep <waittime> seconds, up to <retry> times,
- # and verify if VPP is running.
- for _ in range(retries):
- time.sleep(waittime)
- (ret, _, _) = \
- ssh.exec_command('echo show hardware-interfaces | '
- 'nc 0 5002 || echo "VPP not yet running"')
- if ret == 0:
- break
- else:
- raise RuntimeError('VPP failed to restart on node {}'.
- format(self._hostname))
+ def add_tcp_preallocated_connections(self, value):
+ """Add TCP pre-allocated connections.
+
+ :param value: The number of pre-allocated connections.
+ :type value: int
+ """
+ path = [u"tcp", u"preallocated-connections"]
+ self.add_config_item(self._nodeconfig, value, path)
+
+ def add_tcp_preallocated_half_open_connections(self, value):
+ """Add TCP pre-allocated half open connections.
+
+ :param value: The number of pre-allocated half open connections.
+ :type value: int
+ """
+ path = [u"tcp", u"preallocated-half-open-connections"]
+ self.add_config_item(self._nodeconfig, value, path)
+
+ def add_session_enable(self):
+ """Add session enable."""
+ path = [u"session", u"enable"]
+ self.add_config_item(self._nodeconfig, u"", path)
+
+ def add_session_event_queues_memfd_segment(self):
+ """Add session event queue memfd segment."""
+ path = [u"session", u"evt_qs_memfd_seg"]
+ self.add_config_item(self._nodeconfig, u"", path)
+
+ def add_session_event_queue_length(self, value):
+ """Add session event queue length.
+
+ :param value: Session event queue length.
+ :type value: int
+ """
+ path = [u"session", u"event-queue-length"]
+ self.add_config_item(self._nodeconfig, value, path)
+
+ def add_session_event_queues_segment_size(self, value):
+ """Add session event queue length.
+
+ :param value: Session event queue segment size.
+ :type value: str
+ """
+ path = [u"session", u"evt_qs_seg_size"]
+ self.add_config_item(self._nodeconfig, value, path)
+
+ def add_session_preallocated_sessions(self, value):
+ """Add the number of pre-allocated sessions.
+
+ :param value: Number of pre-allocated sessions.
+ :type value: int
+ """
+ path = [u"session", u"preallocated-sessions"]
+ self.add_config_item(self._nodeconfig, value, path)
+
+ def add_session_v4_session_table_buckets(self, value):
+ """Add number of v4 session table buckets to the config.
+
+ :param value: Number of v4 session table buckets.
+ :type value: int
+ """
+ path = [u"session", u"v4-session-table-buckets"]
+ self.add_config_item(self._nodeconfig, value, path)