summaryrefslogtreecommitdiff
path: root/src/dumm/ext/lib
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
committerYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
commite0e280b7669435b991b7e457abd8aa450930b3e8 (patch)
tree3e6084f13b14ad2df104e2ce6e589eb96c5f7ac9 /src/dumm/ext/lib
parent51a71ee15c1bcf0e82f363a16898f571e211f9c3 (diff)
downloadvyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.tar.gz
vyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.zip
New upstream version 5.7.0
Diffstat (limited to 'src/dumm/ext/lib')
-rw-r--r--src/dumm/ext/lib/dumm.rb63
-rw-r--r--src/dumm/ext/lib/dumm/guest.rb59
2 files changed, 0 insertions, 122 deletions
diff --git a/src/dumm/ext/lib/dumm.rb b/src/dumm/ext/lib/dumm.rb
deleted file mode 100644
index 0dd7ada10..000000000
--- a/src/dumm/ext/lib/dumm.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-=begin
- Copyright (C) 2008-2009 Tobias Brunner
- HSR Hochschule fuer Technik Rapperswil
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-=end
-
-require 'dumm.so'
-require 'dumm/guest'
-
-module Dumm
-
- # use guest/bridge indentifiers directly
- def method_missing(id, *args)
- if Guest.guest? id
- return Guest[id]
- end
- if Bridge.bridge? id
- return Bridge[id]
- end
- super(id, *args)
- end
-
- # shortcut for Template loading
- def template(name = nil)
- if name
- Template.load name
- else
- Template.sort.each {|t| puts t }
- end
- return Dumm
- end
-
- # unload template/overlays, reset all guests and delete bridges
- def reset
- Template.unload
- Guest.each { |guest|
- guest.reset
- }
- Bridge.each { |bridge|
- bridge.delete
- }
- return Dumm
- end
-
- # wait until all running guests have booted up
- def boot
- Guest.each {|g|
- g.boot if g.running?
- }
- return Dumm
- end
-end
-
-# vim:sw=2 ts=2 et
diff --git a/src/dumm/ext/lib/dumm/guest.rb b/src/dumm/ext/lib/dumm/guest.rb
deleted file mode 100644
index 6978edcb3..000000000
--- a/src/dumm/ext/lib/dumm/guest.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-=begin
- Copyright (C) 2008-2010 Tobias Brunner
- HSR Hochschule fuer Technik Rapperswil
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2 of the License, or (at your
- option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-=end
-
-module Dumm
- class Guest
- # accessor for guests
- # e.g. Guest.sun instead of Guest["sun"]
- def self.method_missing(id, *args)
- unless guest? id
- super(id, *args)
- end
- Guest[id]
- end
-
- # accessor for interfaces
- # e.g. guest.eth0 instead of guest["eth0"]
- def method_missing(id, *args)
- unless iface? id
- super(id, *args)
- end
- self[id]
- end
-
- # remove all overlays, delete all interfaces
- def reset
- while pop_overlay; end
- each {|i|
- i.delete
- }
- end
-
- # has the guest booted up?
- def booted?
- exec("pgrep getty")
- execstatus == 0
- end
-
- # wait until the guest has booted
- def boot
- while not booted?
- sleep(1)
- end
- end
- end
-end
-
-# vim:sw=2 ts=2 et