Class: Yast::ISDNClass
- Inherits:
-
Module
- Object
- Module
- Yast::ISDNClass
- Defined in:
- ../../src/modules/ISDN.rb
Instance Method Summary (collapse)
-
- (Object) Add
selects next free cfg-contr and initialisize all cfg-contr values.
-
- (Object) AddIf(proto)
selects next free cfg-net and initialisize all cfg-net values.
-
- (Object) Commit
commit changes of the current item defined by type device.
-
- (Object) CountIF
Count of valid interface entries.
-
- (Object) Delete(item)
selects cfg- for delete.
-
- (Object) Edit(dev)
selects cfg- for edit.
-
- (Object) EditIf(item)
selects interface cfg- for edit.
- - (Object) Export
- - (Object) GetInterface4Provider(prov)
-
- (Object) IfaceName(num, iface)
Name of interface.
- - (Object) Import(settings)
-
- (Array) Locate(key, val)
Locate interfaces of the given key and value.
- - (Object) main
-
- (Object) Modified
Data was modified?.
-
- (Array<Strings>) NetDeviceList
List of configured interface entries.
- - (Object) OverviewDev
- - (Object) OverviewIf
-
- (Object) PrepareInterface
If not allready done set a valid interface.
-
- (Object) Read
Read all ISDN settings from the SCR.
-
- (Object) SelectHW(which)
Select the given hardware item or clean up structures FIXME: -> routines/hardware.ycp (?) sel for the interface.
-
- (Object) SelectInterface(auto)
Displays a popup to select one interface to be the current interface.
-
- (Object) SelIf(item)
selects interface cfg-.
-
- (Object) set_cardparameters(cfg)
default settings of hw device.
-
- (Object) set_hwparameters(hw)
copy detected hw settings to current item.
-
- (Object) set_ifparameters(cfg)
default settings of interface.
-
- (Object) Summary(split)
Build a textual summary and a list of unconfigured cards.
-
- (Object) TestDev(dev)
Test the given card settings.
- - (Object) UnconfiguredDev
-
- (Object) Write(start)
Update the SCR according to network settings if start is true, load drivers and interfaces.
-
- (Object) WriteOnly
Only write configuration without starting any init scripts and SuSEconfig.
Instance Method Details
- (Object) Add
selects next free cfg-contr<N> and initialisize all cfg-contr<N> values
744 745 746 747 748 749 750 751 |
# File '../../src/modules/ISDN.rb', line 744 def Add @type = "contr" @device = Builtins.sformat("%1%2", @type, GetFreeDevice(@type)) Builtins.y2internal("New Added device %1", @device) @hw_device = set_cardparameters({}) @operation = :add true end |
- (Object) AddIf(proto)
selects next free cfg-net<N> and initialisize all cfg-net<N> values
801 802 803 804 805 806 807 808 809 |
# File '../../src/modules/ISDN.rb', line 801 def AddIf(proto) @type = "net" @device = Builtins.sformat("%1%2", @type, GetFreeDevice(@type)) @interface = { "PROTOCOL" => proto, "USERCONTROL" => "yes" } @interface = set_ifparameters(@interface) @operation = :addif Builtins.y2milestone("Adding network configuration %1", @device) true end |
- (Object) Commit
commit changes of the current item defined by type device
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 |
# File '../../src/modules/ISDN.rb', line 850 def Commit Builtins.y2debug("Commit(%1) dev:%2%3", @operation, @type, @device) Builtins.y2debug("skip %1", @skip) return true if @operation == nil if @skip && @operation != :add && @operation != :edit && @operation != :delete @skip = false return true end if @operation == :edit || @operation == :editif || @operation == :addproc typemap = Ops.get(@Devices, @type, {}) Builtins.y2debug("typemap %1", typemap) if !Builtins.haskey(typemap, @device) Builtins.y2error("Key not found: %1", @device) return false end end if @operation == :add || @operation == :edit ac = Ops.get_string(@hw_device, "AREACODE", "") @global_ac = ac if ac != "" dp = Ops.get_string(@hw_device, "DIALPREFIX", "") @global_dp = dp sm = Ops.get_string(@hw_device, "STARTMODE", "") @global_sm = "hotplug" if sm == "hotplug" @global_sm = "manual" if sm == "manual" && @global_sm == "auto" ChangeDevice(@type, @device, @hw_device, @operation == :add) @modified_hw = true elsif @operation == :addif || @operation == :editif Ops.set(@interface, "PROVIDER", @provider_file) ChangeDevice(@type, @device, @interface, @operation == :addif) @modified_if = true # } else if(operation == `addprov || operation == `editprov) { # handled in Provider module elsif @operation == :testdev Builtins.y2debug("op testdev") elsif @operation == :delete if @type == "net" p = Ops.get_string(@interface, "PROTOCOL", "") devnam = "" if p == "syncppp" devnam = Builtins.sformat("ippp%1", @device) elsif p == "rawip" devnam = Builtins.sformat("isdn%1", @device) else devnam = Builtins.sformat("unknown%1", @device) end SuSEFirewall4Network.ProtectByFirewall(devnam, "EXT", false) end DeleteDevice(@type, @device) if @type == "contr" @modified_hw = true else @modified_if = true end else Builtins.y2error("Unknown operation: %1", @operation) return false end @operation = nil true end |
- (Object) CountIF
Count of valid interface entries
1038 1039 1040 1041 1042 |
# File '../../src/modules/ISDN.rb', line 1038 def CountIF typemap = Ops.get(@Devices, "net", {}) Builtins.size(typemap) end |
- (Object) Delete(item)
selects cfg-<item> for delete
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
# File '../../src/modules/ISDN.rb', line 780 def Delete(item) @operation = nil typ = NetworkInterfaces.device_type(item) # string num = NetworkInterfaces::device_num(item); typemap = Ops.get(@Devices, typ, {}) if !Builtins.haskey(typemap, item) Builtins.y2error("Key not found: %1", item) return false end @interface = Ops.get_map(typemap, item, {}) if @type == "net" @type = typ @device = item @operation = :delete true end |
- (Object) Edit(dev)
selects cfg-<dev> for edit
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 |
# File '../../src/modules/ISDN.rb', line 756 def Edit(dev) typ = NetworkInterfaces.device_type(dev) # string num = NetworkInterfaces::device_num(dev); typemap = Ops.get(@Devices, typ, {}) if !Builtins.haskey(typemap, dev) Builtins.y2error("Key not found: %1", dev) return false end @hw_device = Ops.get_map(typemap, dev, {}) Builtins.y2debug("Hardware: %1", @Hardware) @device = dev @type = typ @hw_device = set_cardparameters(@hw_device) Builtins.y2debug("devmap=%1", @hw_device) @operation = :edit true end |
- (Object) EditIf(item)
selects interface cfg-<item> for edit
839 840 841 842 843 844 845 |
# File '../../src/modules/ISDN.rb', line 839 def EditIf(item) if SelIf(item) @operation = :editif return true end false end |
- (Object) Export
931 932 933 934 |
# File '../../src/modules/ISDN.rb', line 931 def Export _PROVIDERS = Provider.Export("isdn") Builtins.add(@Devices, "_PROVIDERS", _PROVIDERS) end |
- (Object) GetInterface4Provider(prov)
1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File '../../src/modules/ISDN.rb', line 1109 def GetInterface4Provider(prov) ifn = "" typemap = Convert.convert( Ops.get(@Devices, "net", {}), :from => "map", :to => "map <string, map>" ) Builtins.maplist(typemap) do |num, devmap| if prov == Ops.get_string(devmap, "PROVIDER", "") if "syncppp" == Ops.get_string(devmap, "PROTOCOL", "") ifn = Builtins.sformat("ippp%1", num) else ifn = Builtins.sformat("isdn%1", num) end end false end ifn end |
- (Object) IfaceName(num, iface)
Returns name of interface
220 221 222 223 224 225 |
# File '../../src/modules/ISDN.rb', line 220 def IfaceName(num, iface) iface = deep_copy(iface) protocol = Ops.get_string(iface, "PROTOCOL", "") format = { "syncppp" => "ippp%1", "rawip" => "isdn%1" } Builtins.sformat(Ops.get_string(format, protocol, "unknown%1"), num) end |
- (Object) Import(settings)
919 920 921 922 923 924 925 926 927 928 |
# File '../../src/modules/ISDN.rb', line 919 def Import(settings) settings = deep_copy(settings) Provider.Import("isdn", Ops.get_map(settings, "_PROVIDERS", {})) @Devices = Convert.convert( Builtins.add(settings, "_PROVIDERS", nil), :from => "map", :to => "map <string, map>" ) true end |
- (Array) Locate(key, val)
Locate interfaces of the given key and value
231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File '../../src/modules/ISDN.rb', line 231 def Locate(key, val) netdevs = Convert.convert( Ops.get(@Devices, "net", {}), :from => "map", :to => "map <string, map>" ) ret = [] Builtins.foreach(netdevs) do |num, dev| if Ops.get_string(dev, key, "") == val ret = Builtins.add(ret, IfaceName(num, dev)) end end deep_copy(ret) end |
- (Object) main
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File '../../src/modules/ISDN.rb', line 37 def main Yast.import "UI" textdomain "network" Yast.import "NetworkInterfaces" Yast.import "NetworkService" Yast.import "Provider" Yast.import "Progress" Yast.import "Summary" Yast.import "PackageSystem" Yast.import "SuSEFirewall4Network" #------------- # GLOBAL DATA @proposal_valid = false # hold current device settings # # handled items are # line specific # PROTOCOL D-channel protocol # AREACODE international area code # DIALPREFIX dialprefixfor PBX setups # hw specific # PARA_IO IO address for legacy ISA # PARA_MEMBASE memory base address for legacy ISA # PARA_IRQ IRQ number for legacy ISA # PARA_TYPE card type # PARA_SUBTYPE card sub type # NAME full card name # DRIVER driver module name # STARTMODE "auto"|"manual"|"hotplug" # DEBUG debuglevel # UDI unique hw id # @hw_device = {} # global dialprefix default value for current @global_dp = "" # global areacode default value for current @global_ac = "" # global start mode @global_sm = "" # ISDN database based on CDB # # map with two keys, of maps: # Cards: # map, keyed by integers, of maps: # CardID: integer (the key) # VendorRef: integer # bus: string (ISA) # class: string (ISDN Single/Multiple Basic Rate) # device: integer # driver: list of driver maps # features: integer # lines: integer # longname: string # name: string # revision: integer # subdevice: integer # subvendor: integer # vendor: integer # Vendors: # map, keyed by integers, of maps: # VendorID: integer (the key) # name: string # refcnt: integer # shortname: string # # # driver map: # IO: list<string> # IRQ: list<string> # MEMBASE: list<string> # description: string # drvid: integer # info: string # mod_name: string # name: string # need_pkg: list<string> # protocol: list<string> # subtype: integer # type: integer @ISDNCDB = {} # hold current interface settings # # handled items are # IPADDR local IP address # REMOTE_ADDR remote IP address # DEFAULTROUTE default route yes/no # DYNAMICIP dynamic IP assignment yes/no # PROTOCOL encapsulation "rawip" | "syncppp" # MSN own phone number # CHARGEHUP try to hangup on idle just before next charge # CALLBACK callback mode # CBDELAY callback delay # STARTMODE auto | manual | hotplug # USERCONTROL controllable bt user yes/no # MULTILINK channel bundling yes/no # PROVIDER default provider filename # IPPPD_OPTIONS additional ipppd options # @interface = {} # set if here is any ISDN interface @provider_file = "" # current item @type = "" @device = "" # Flag for Fritz!card DSL configuration @have_dsl = false @only_dsl = false @DRDSLrun = false @installpackages = [] # Which operation is pending? @operation = nil # If the interface or provider configuration is skipped @skip = false #-------------- # PRIVATE DATA # Hardware information # @see #ReadHardware @Hardware = [] # Config information # @see #ReadDevices @Devices = {} # deleted devices @DeletedDevices = [] # configured ISDN net devices @NetDevs = [] # Abort function # return boolean return true if abort @AbortFunction = nil # Data was modified? @modified_hw = false @modified_if = false @description = "" @unique = "" @hotplug = "" @alias = "" @Requires = [] # because of hardware.ycp Yast.include self, "network/devices.rb" Yast.include self, "network/hardware.rb" Yast.include self, "network/routines.rb" Yast.include self, "network/complex.rb" Yast.include self, "network/isdn/config.rb" Yast.include self, "network/isdn/routines.rb" Yast.include self, "network/runtime.rb" end |
- (Object) Modified
Data was modified?
214 215 216 217 |
# File '../../src/modules/ISDN.rb', line 214 def Modified Builtins.y2debug("modified(hw,if)=%1,%2", @modified_hw, @modified_if) @modified_hw || @modified_if end |
- (Array<Strings>) NetDeviceList
List of configured interface entries
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 |
# File '../../src/modules/ISDN.rb', line 938 def NetDeviceList typemap = Convert.convert( Ops.get(@Devices, "net", {}), :from => "map", :to => "map <string, map>" ) @NetDevs = [] Builtins.maplist(typemap) do |num, devmap| prot = Ops.get_string(devmap, "PROTOCOL", "") devnam = "" if prot == "syncppp" devnam = Builtins.sformat("ippp%1", num) elsif prot == "rawip" devnam = Builtins.sformat("isdn%1", num) else devnam = Builtins.sformat("unkown%1", num) end @NetDevs = Builtins.add(@NetDevs, devnam) end deep_copy(@NetDevs) # better: return maplist (string num, map devmap, typemap, ``( IfaceName (num, devmap) )); end |
- (Object) OverviewDev
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
# File '../../src/modules/ISDN.rb', line 969 def OverviewDev res = Builtins.filter( Convert.convert( BuildOverviewDevs(@Devices, @Hardware), :from => "list", :to => "list <term>" ) ) do |i| Builtins.issubstring(Ops.get_string(i, [0, 0], ""), "contr") end Builtins.maplist( Convert.convert(res, :from => "list", :to => "list <term>") ) do |card| id = Ops.get_string(card, [0, 0], "") desc = [ Ops.get_string(card, 1, ""), Ops.get_string(card, 2, ""), Ops.get_string(card, 3, "") ] { "id" => id, "rich_descr" => Ops.get_locale( card, 4, Ops.get_locale(desc, 1, _("Unknown")) ), "table_descr" => desc } end end |
- (Object) OverviewIf
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 |
# File '../../src/modules/ISDN.rb', line 1004 def OverviewIf res = Builtins.filter( Convert.convert( BuildOverviewDevs(@Devices, @Hardware), :from => "list", :to => "list <term>" ) ) { |i| Builtins.issubstring(Ops.get_string(i, [0, 0], ""), "net") } Builtins.maplist( Convert.convert(res, :from => "list", :to => "list <term>") ) do |card| id = Ops.get_string(card, [0, 0], "") desc = [ Ops.get_string(card, 1, ""), Ops.get_string(card, 2, ""), Ops.get_string(card, 3, "") ] { "id" => id, "rich_descr" => Ops.get_locale( card, 4, Ops.get_locale(desc, 1, _("Unknown")) ), "table_descr" => desc } end #return BuildOverview("net"); end |
- (Object) PrepareInterface
If not allready done set a valid interface
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 |
# File '../../src/modules/ISDN.rb', line 1047 def PrepareInterface if Ops.greater_than(Builtins.tointeger(@device), -1) && @type == "net" return true end typemap = Convert.convert( Ops.get(@Devices, "net", {}), :from => "map", :to => "map <string, map>" ) return false if 0 == Builtins.size(typemap) id = "" Builtins.maplist(typemap) do |num, devmap| id = Builtins.sformat("net%1", num) end SelIf(id) end |
- (Object) Read
Read all ISDN settings from the SCR
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File '../../src/modules/ISDN.rb', line 248 def Read # title for ISDN reading current setup progress screen caption = _("Initializing ISDN Card Configuration") steps = 5 sl = 0 # 1000; /* TESTING Builtins.sleep(sl) Progress.New( caption, " ", steps, [ # stages for the ISDN reading current setup progress screen # stage 1/5 _("Detect devices"), # stage 2/5 _("Read current device configuration"), # stage 3/5 _("Read current connection setup"), # stage 4/5 _("Read firewall settings"), # stage 5/5 _("Read providers") ], [], "" ) @Devices = {} return false if Abort() # check the environment return false if !Confirm.MustBeRoot # step 1 in reading current ISDN setup ProgressNextStage(_("Detecting ISDN cards...")) @Hardware = ReadHardware("isdn") Builtins.sleep(sl) return false if Abort() # step 2 in reading current ISDN setup ProgressNextStage(_("Reading current device configuration...")) ReadISDNConfig("cfg-contr") NetworkService.Read Builtins.sleep(sl) return false if Abort() # step 3 in reading current ISDN setup ProgressNextStage(_("Reading current connection setup...")) ReadISDNConfig("cfg-net") Builtins.sleep(sl) return false if Abort() # step 4 in reading current ISDN setup ProgressNextStage(_("Reading firewall settings...")) progress_orig = Progress.set(false) SuSEFirewall4Network.Read Progress.set(progress_orig) Builtins.sleep(sl) return false if Abort() # step 5 in reading current ISDN setup ProgressNextStage(_("Reading providers...")) Provider.Read Builtins.sleep(sl) return false if Abort() # last step in reading current ISDN setup ProgressNextStage(_("Finished")) Builtins.sleep(sl) return false if Abort() @modified_hw = false @modified_if = false true end |
- (Object) SelectHW(which)
Select the given hardware item or clean up structures FIXME: -> routines/hardware.ycp (?) sel for the interface
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
# File '../../src/modules/ISDN.rb', line 718 def SelectHW(which) sel = {} sel = Ops.get(@Hardware, which, {}) if which != nil if Ops.greater_than(which, Builtins.size(@Hardware)) || Ops.less_than(which, 0) Builtins.y2error( "Item not found in Hardware: %1 (%2)", which, Builtins.size(@Hardware) ) end @type = "contr" @device = Builtins.sformat("%1%2", @type, GetFreeDevice(@type)) @hw_device = set_cardparameters({}) set_hwparameters(sel) @operation = :add nil end |
- (Object) SelectInterface(auto)
Displays a popup to select one interface to be the current interface
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File '../../src/modules/ISDN.rb', line 1070 def SelectInterface(auto) typemap = Convert.convert( Ops.get(@Devices, "net", {}), :from => "map", :to => "map <string, map>" ) id = "" s = Builtins.size(typemap) Builtins.y2debug("device = %1", @device) Builtins.y2debug("typemap = %1", typemap) return false if s == 0 if auto && s == 1 Builtins.maplist(typemap) do |num, devmap| id = Builtins.sformat("net%1", num) end return SelIf(id) end ifl = Builtins.maplist(typemap) do |num, devmap| p = Ops.get_string(devmap, "PROTOCOL", "") devid = Builtins.sformat("net%1", num) devnam = "" if p == "syncppp" devnam = Builtins.sformat("ippp%1", num) elsif p == "rawip" devnam = Builtins.sformat("isdn%1", num) else devnam = Builtins.sformat("unknown%1", num) end Item(Id(devid), devnam, num == @device) end Builtins.y2debug("ifl=%1", ifl) # label of a single combo box in a popup to select a interface for an edit/delete operation id = select_fromlist_popup(_("&Select Interface"), ifl) SelIf(id) end |
- (Object) SelIf(item)
selects interface cfg-<item>
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
# File '../../src/modules/ISDN.rb', line 814 def SelIf(item) typ = NetworkInterfaces.device_type(item) num = NetworkInterfaces.device_num(item) typemap = Ops.get(@Devices, typ, {}) if !Builtins.haskey(typemap, num) Builtins.y2error("Key not found: %1", item) return false end @interface = Ops.get_map(typemap, num, {}) # interface settings @interface = set_ifparameters(@interface) Ops.set( @interface, "NAME", BuildDescription(typ, num, @interface, @Hardware) ) @device = num @type = typ true end |
- (Object) set_cardparameters(cfg)
default settings of hw device
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 |
# File '../../src/modules/ISDN.rb', line 657 def set_cardparameters(cfg) cfg = deep_copy(cfg) ac = Ops.get_string(cfg, "AREACODE", @global_ac) @global_ac = ac if @global_ac == "" Ops.set(cfg, "AREACODE", ac) dp = Ops.get_string(cfg, "DIALPREFIX", @global_dp) @global_dp = dp if @global_dp == "" Ops.set(cfg, "DIALPREFIX", dp) if dp != "" sm = Ops.get_string(cfg, "STARTMODE", "auto") @global_sm = "hotplug" if sm == "hotplug" sm = "auto" if sm == "" Ops.set(cfg, "STARTMODE", sm) deep_copy(cfg) end |
- (Object) set_hwparameters(hw)
copy detected hw settings to current item
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# File '../../src/modules/ISDN.rb', line 695 def set_hwparameters(hw) hw = deep_copy(hw) # Fixme parameter lookup for ISA hardware Ops.set(@hw_device, "PARA_TYPE", Builtins.sformat("%1", get_i4ltype(hw))) Ops.set( @hw_device, "PARA_SUBTYPE", Builtins.sformat("%1", get_i4lsubtype(hw)) ) Ops.set( @hw_device, "NAME", Builtins.sformat("%1", Ops.get_string(hw, "name", "unknown")) ) Ops.set(@hw_device, "UNIQUE", Ops.get_string(hw, "unique", "")) nil end |
- (Object) set_ifparameters(cfg)
default settings of interface
679 680 681 682 683 684 685 686 687 688 689 |
# File '../../src/modules/ISDN.rb', line 679 def set_ifparameters(cfg) cfg = deep_copy(cfg) sm = Ops.get_string(cfg, "STARTMODE", "manual") @global_sm = sm if @global_sm == "" sm = "auto" if sm == "" Ops.set(cfg, "STARTMODE", sm) @provider_file = Ops.get_string(cfg, "PROVIDER", "") deep_copy(cfg) end |
- (Object) Summary(split)
Build a textual summary and a list of unconfigured cards
964 965 966 |
# File '../../src/modules/ISDN.rb', line 964 def Summary(split) BuildSummaryDevs(@Devices, @Hardware, split, false) end |
- (Object) TestDev(dev)
Test the given card settings
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File '../../src/modules/ISDN.rb', line 552 def TestDev(dev) # title for ISDN testing current setup progress screen caption = Builtins.sformat(_("Testing ISDN Configuration %1"), dev) cmd = "" details = "" out = {} result = 1 steps = 5 sl = 500 #1000; Builtins.sleep(sl) Progress.New( caption, " ", steps, [ # stages for the ISDN testing current setup progress screen # stage 1/5 _("Write controller configuration"), # stage 2/5 _("Stop ISDN network"), # stage 3/5 _("Unload ISDN driver"), # stage 4/5 _("Load controller"), # stage 5/5 _("Unload controller") ], [], "" ) return false if Abort() # step 1 in testing current ISDN setup ProgressNextStage(_("Writing controller configuration...")) WriteOneISDNConfig(dev) Builtins.sleep(sl) return false if Abort() # step 2 in testing current ISDN setup ProgressNextStage(_("Stopping ISDN network...")) cmd = Builtins.sformat("/etc/init.d/network stop -o type=isdn") out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) details = Ops.add(Ops.add(details, cmd), "\n") details = Ops.add(details, Ops.get_string(out, "stdout", "")) details = Ops.add(details, Ops.get_string(out, "stderr", "")) details = Ops.add(details, "\n") cmd = Builtins.sformat("/etc/init.d/network stop -o type=ippp") out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) details = Ops.add(Ops.add(details, cmd), "\n") details = Ops.add(details, Ops.get_string(out, "stdout", "")) details = Ops.add(details, Ops.get_string(out, "stderr", "")) details = Ops.add(details, "\n") Builtins.sleep(sl) return false if Abort() # step 3 in testing current ISDN setup ProgressNextStage(_("Unloading ISDN driver...")) cmd = Builtins.sformat("/etc/init.d/isdn unload") out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) details = Ops.add(Ops.add(details, cmd), "\n") details = Ops.add(details, Ops.get_string(out, "stdout", "")) details = Ops.add(details, Ops.get_string(out, "stderr", "")) details = Ops.add(details, "\n") Builtins.sleep(sl) return false if Abort() # step 4 in testing current ISDN setup ProgressNextStage(_("Loading controller...")) cmd = Builtins.sformat("/etc/init.d/isdn start %1 -o all", dev) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) details = Ops.add(Ops.add(details, cmd), "\n") details = Ops.add(details, Ops.get_string(out, "stdout", "")) details = Ops.add(details, Ops.get_string(out, "stderr", "")) details = Ops.add(details, "\n") result = Ops.get_integer(out, "exit", 1) Builtins.sleep(sl) return false if Abort() # step 5 in testing current ISDN setup ProgressNextStage(_("Unloading controller...")) cmd = Builtins.sformat("/etc/init.d/isdn unload") out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) details = Ops.add(Ops.add(details, cmd), "\n") details = Ops.add(details, Ops.get_string(out, "stdout", "")) details = Ops.add(details, Ops.get_string(out, "stderr", "")) details = Ops.add(details, "\n") Builtins.sleep(sl) return false if Abort() # last step in testing current ISDN setup ProgressNextStage(_("Finished")) Builtins.sleep(sl) return false if Abort() display_testresult(result, details) @operation = :testdev true end |
- (Object) UnconfiguredDev
1000 1001 1002 |
# File '../../src/modules/ISDN.rb', line 1000 def UnconfiguredDev BuildUnconfiguredDevs(@Devices, "isdn", @Hardware) end |
- (Object) Write(start)
Update the SCR according to network settings if start is true, load drivers and interfaces
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File '../../src/modules/ISDN.rb', line 342 def Write(start) # install qinternet if there is at least one ISDN device - #161782 if Ops.greater_than(Builtins.size(Ops.get(@Devices, "contr", {})), 0) && !PackageSystem.Installed("qinternet") @installpackages = Builtins.add(@installpackages, "qinternet") end if @installpackages != nil && @installpackages != [""] retp = PackagesInstall( Convert.convert( @installpackages, :from => "list", :to => "list <string>" ) ) Builtins.y2debug("Packages returns %1", retp) end haveISDNDev = {} != Ops.get(@Devices, "contr", {}) if !(@modified_hw || @modified_if || Provider.Modified("isdn")) return true end Builtins.y2milestone("Writing configuration") # title for ISDN writing current setup progress screen caption = _("Saving ISDN Configuration") cmd = "" sl = 0 # 1000; /* TESTING steps = 7 plist = [] haveISDNif = {} != Ops.get(@Devices, "net", {}) # stages for the ISDN writing current setup progress screen with start # stage 1/13 plist = Builtins.add(plist, _("Stop ISDN networking")) # stage 2/13 plist = Builtins.add(plist, _("Stop ISDN subsystem")) # stage 3/13 plist = Builtins.add(plist, _("Write controller configuration")) # stage 4/13 plist = Builtins.add(plist, _("Write interface configuration")) # stage 5/13 plist = Builtins.add(plist, _("Write firewall")) # stage 6/13 plist = Builtins.add(plist, _("Write providers")) # stage 7/13 plist = Builtins.add(plist, _("Update configuration")) if start steps = 8 # stage 8/13 plist = Builtins.add(plist, _("Start ISDN subsystem")) if @DRDSLrun # stage 9/13 plist = Builtins.add(plist, _("Run drdsl")) steps = 9 end if haveISDNif steps = Ops.add(steps, 4) # stage 11/13 plist = Builtins.add(plist, _("Set up network services")) # stage 11/13 plist = Builtins.add(plist, _("Set up smpppd")) # stage 12/13 plist = Builtins.add(plist, _("Start ISDN networking")) # Progress stage 9 plist = Builtins.add(plist, _("Activate network services")) end end Progress.New(caption, " ", steps, plist, [], "") return false if Abort() # step 1 in writing current ISDN setup ProgressNextStage(_("Stopping ISDN networking...")) cmd = Builtins.sformat("/etc/init.d/network stop -o type=isdn") SCR.Execute(path(".target.bash"), cmd) cmd = Builtins.sformat("/etc/init.d/network stop -o type=ippp") SCR.Execute(path(".target.bash"), cmd) Builtins.sleep(sl) return false if Abort() # step 2 in writing current ISDN setup ProgressNextStage(_("Stopping ISDN subsystem...")) if @modified_hw cmd = Builtins.sformat("/etc/init.d/isdn unload") SCR.Execute(path(".target.bash"), cmd) end Builtins.sleep(sl) return false if Abort() # step 3 in writing current ISDN setup ProgressNextStage(_("Writing controller configuration...")) WriteISDNConfig("contr") if @modified_hw Builtins.sleep(sl) return false if Abort() # step 4 in writing current ISDN setup ProgressNextStage(_("Writing interface configuration...")) WriteISDNConfig("net") Builtins.sleep(sl) return false if Abort() # step 5 in writing current ISDN setup ProgressNextStage(_("Writing firewall settings...")) progress_orig = Progress.set(false) SuSEFirewall4Network.Write Progress.set(progress_orig) Builtins.sleep(sl) return false if Abort() # step 6 in writing current ISDN setup ProgressNextStage(_("Writing providers...")) Provider.Write("isdn") if Provider.Modified("isdn") Builtins.sleep(sl) return false if Abort() # step 7 in writing current ISDN setup ProgressNextStage(_("Updating configuration...")) SCR.Execute( path(".target.bash"), "/etc/sysconfig/isdn/scripts/postprocess.isdn" ) Builtins.sleep(sl) return false if Abort() if start # step 8 in writing current ISDN setup ProgressNextStage(_("Loading ISDN driver...")) if @modified_hw cmd = Builtins.sformat("/etc/init.d/isdn start -o all") SCR.Execute(path(".target.bash"), cmd) @modified_hw = false end Builtins.sleep(sl) return false if Abort() if @DRDSLrun # step 9 in writing current ISDN setup ProgressNextStage(_("Running drdsl (could take over a minute)...")) # Avoid some race. kkeil: # I got one customer report about this race, but never # was able to reproduce, on the customer side this sleep # fixes the problem. It seems that after loading the # firmware the controller does some more internal # stuff. If drdsl is called too early, it will confuse # the controller and it does not get valid values. # One second is small compared to 10-20s for drdsl itself. Builtins.sleep(1000) cmd = Builtins.sformat("/usr/sbin/drdsl -q") SCR.Execute(path(".target.bash"), cmd) Builtins.sleep(sl) end if haveISDNif return false if Abort() # step 10 in writing current ISDN setup ProgressNextStage(_("Setting up network services...")) NetworkService.EnableDisable Builtins.sleep(sl) return false if Abort() # step 11 in writing current ISDN setup ProgressNextStage(_("Setting up smpppd(8)...")) SetupSMPPPD(true) Builtins.sleep(sl) return false if Abort() # step 12 in writing current ISDN setup ProgressNextStage(_("Loading ISDN network...")) cmd = Builtins.sformat("/etc/init.d/network start -o type=isdn") SCR.Execute(path(".target.bash"), cmd) cmd = Builtins.sformat("/etc/init.d/network start -o type=ippp") SCR.Execute(path(".target.bash"), cmd) @modified_if = false Builtins.sleep(sl) return false if Abort() # Progress step 9 ProgressNextStage(_("Activating network services...")) write_only = false if !write_only # NetworkModules::HwUp (); // this is needed too NetworkService.StartStop end Builtins.sleep(sl) end end return false if Abort() # last step in writing current ISDN setup if haveISDNDev cmd = Builtins.sformat("/sbin/insserv isdn") # #104590 SCR.Execute(path(".target.bash"), cmd) else cmd = Builtins.sformat("/sbin/insserv -r capisuite") SCR.Execute(path(".target.bash"), cmd) cmd = Builtins.sformat("/sbin/insserv -r isdn") SCR.Execute(path(".target.bash"), cmd) end ProgressNextStage(_("Finished")) Builtins.sleep(sl) return false if Abort() true end |
- (Object) WriteOnly
Only write configuration without starting any init scripts and SuSEconfig
331 332 333 334 335 336 |
# File '../../src/modules/ISDN.rb', line 331 def WriteOnly WriteISDNConfig("contr") WriteISDNConfig("net") Provider.Write("isdn") true end |