コード例 #1
0
ファイル: configuration.py プロジェクト: richardstrnad/exabgp
	def debug_self_check (self):
		# we are not really running the program, just want check the configuration validity
		if environment.settings().debug.selfcheck:
			from exabgp.configuration.check import check_neighbor
			if check_neighbor(self.neighbors):
				sys.exit(0)
			sys.exit(1)
コード例 #2
0
 def debug_self_check(self):
     # we are not really running the program, just want check the configuration validity
     if environment.settings().debug.selfcheck:
         from exabgp.configuration.check import check_neighbor
         if check_neighbor(self.neighbors):
             sys.exit(0)
         sys.exit(1)
コード例 #3
0
ファイル: parsing_test.py プロジェクト: stroboscope/exabgp
 def test_all_configuration(self):
     neighbors = []
     for file in self.files:
         # print file.split('/')[-1]
         configuration = Configuration([
             file,
         ])
         configuration.reload()
         self.assertEqual(check_neighbor(configuration.neighbor), True)
         del configuration
コード例 #4
0
ファイル: parsing_test.py プロジェクト: Tourountzis/exabgp
 def test_all_configuration (self):
     neighbors = []
     for filename in self.files:
         if filename.endswith(self.skip):
             continue
         print filename
         configuration = Configuration([filename,])
         configuration.reload()
         self.assertEqual(check_neighbor(configuration.neighbor),True)
         del configuration
コード例 #5
0
ファイル: __init__.py プロジェクト: slabakov/exabgp
	def _reload (self):
		# taking the first configuration available (FIFO buffer)
		fname = self._configurations.pop(0)
		self.process.configuration(fname)
		self._configurations.append(fname)

		# storing the routes associated with each peer so we can find what changed
		backup_changes = {}
		for neighbor in self._neighbors:
			backup_changes[neighbor] = self._neighbors[neighbor].changes

		# clearing the current configuration to be able to re-parse it
		self._clear()

		if not self.tokens.set_file(fname):
			return False

		# parsing the configurtion
		r = False
		while not self.tokens.finished:
			r = self._dispatch(
				self._scope,'configuration',
				['group','neighbor'],
				[]
			)
			if r is False:
				break

		# handling possible parsing errors
		if r not in [True,None]:
			return self.error.set("\nsyntax error in section %s\nline %d: %s\n\n%s" % (self._location[-1],self.tokens.number,' '.join(self.tokens.line),self.error))

		# parsing was sucessful, assigning the result
		self.neighbors = self._neighbors

		# installing in the neighbor what was its previous routes so we can
		# add/withdraw what need to be
		for neighbor in self.neighbors:
			self.neighbors[neighbor].backup_changes = backup_changes.get(neighbor,[])

		# we are not really running the program, just want to ....
		if environment.settings().debug.route:
			from exabgp.configuration.check import check_message
			if check_message(self.neighbors,environment.settings().debug.route):
				sys.exit(0)
			sys.exit(1)

		# we are not really running the program, just want check the configuration validity
		if environment.settings().debug.selfcheck:
			from exabgp.configuration.check import check_neighbor
			if check_neighbor(self.neighbors):
				sys.exit(0)
			sys.exit(1)

		return True
コード例 #6
0
ファイル: parsing_test.py プロジェクト: tomwalsh/exabgp
	def test_all_configuration (self):
		for filename in self.files:
			if filename.endswith(self.skip):
				continue
			print '-'*80
			print filename
			print '='*80
			sys.stdout.flush()
			configuration = Configuration([filename,])
			configuration.reload()
			self.assertEqual(check_neighbor(configuration.neighbor),True)
			del configuration
コード例 #7
0
	def test_all_configuration (self):
		for filename in self.files:
			if filename.endswith(self.skip):
				continue
			print('-'*80)
			print(filename)
			print('='*80)
			sys.stdout.flush()
			configuration = Configuration([filename,])
			configuration.reload()
			self.assertEqual(check_neighbor(configuration.neighbors),True)
			del configuration
コード例 #8
0
 def test_all_configuration(self):
     neighbors = []
     for filename in self.files:
         if filename.endswith(self.skip):
             continue
         print '-' * 80
         print filename
         print '=' * 80
         configuration = Configuration([
             filename,
         ])
         configuration.reload()
         self.assertEqual(check_neighbor(configuration.neighbor), True)
         del configuration