mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-06-05 18:22:10 +03:00
Compare commits
1145 Commits
v1.2
...
v1.4.0alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e05ee6bba0 | ||
|
|
111ed742ec | ||
|
|
8fd5743d75 | ||
|
|
63b79ccf3b | ||
|
|
45f4265c03 | ||
|
|
b7b13ea2cb | ||
|
|
1f660b180e | ||
|
|
3b2ccf75ec | ||
|
|
734fc65c29 | ||
|
|
5252ed16ca | ||
|
|
cec6fcf81a | ||
|
|
a812796bdc | ||
|
|
9abb4fe692 | ||
|
|
42b86c6b18 | ||
|
|
8aec2275fd | ||
|
|
61f03d734b | ||
|
|
907e20d0ec | ||
|
|
f84c759e8d | ||
|
|
f6fb4695c1 | ||
|
|
3a1ccb5ba0 | ||
|
|
7b8ab4ac2c | ||
|
|
53504f1c3d | ||
|
|
d5408165f9 | ||
|
|
9bf8c115c1 | ||
|
|
a06ac4cbb6 | ||
|
|
6406b7412d | ||
|
|
41aca47f92 | ||
|
|
a170e1cfb5 | ||
|
|
b2429a6a1b | ||
|
|
23e1baf92f | ||
|
|
278c94b7df | ||
|
|
256fc5a222 | ||
|
|
a0fa28b3fd | ||
|
|
09d8212225 | ||
|
|
e658786e88 | ||
|
|
4a1e6eba8c | ||
|
|
ce5e209681 | ||
|
|
40178b5277 | ||
|
|
631c487233 | ||
|
|
5e47afe3a4 | ||
|
|
942bf9094d | ||
|
|
985200b6d9 | ||
|
|
35b61bc891 | ||
|
|
b149abbb23 | ||
|
|
536387ad8c | ||
|
|
1628edbb8b | ||
|
|
39adbbdb27 | ||
|
|
be49fa9b54 | ||
|
|
aaed8435d1 | ||
|
|
c5bd406351 | ||
|
|
4004caadc7 | ||
|
|
1ac2a782c4 | ||
|
|
6887928bba | ||
|
|
1401537796 | ||
|
|
e53f5ca175 | ||
|
|
463f49586c | ||
|
|
5a87098f95 | ||
|
|
da44ff05aa | ||
|
|
3839171d42 | ||
|
|
8d9a009f89 | ||
|
|
2c0a4cf7a7 | ||
|
|
4b2269b668 | ||
|
|
3bfff093f8 | ||
|
|
6d835a2068 | ||
|
|
36398c54e0 | ||
|
|
2a2777b22d | ||
|
|
11dc69334d | ||
|
|
c4c17aa115 | ||
|
|
4b41c06dc4 | ||
|
|
a9e27cd63f | ||
|
|
0f6b4f2b32 | ||
|
|
08877155e2 | ||
|
|
7007f3ea44 | ||
|
|
9419cce747 | ||
|
|
033c884059 | ||
|
|
99b0b65e89 | ||
|
|
67042470f3 | ||
|
|
7c5388ee71 | ||
|
|
96634ece3f | ||
|
|
ee9ea92a11 | ||
|
|
246e9f7e3f | ||
|
|
fc43f89d9e | ||
|
|
be75dc95a3 | ||
|
|
6bb0f7b902 | ||
|
|
6178c56606 | ||
|
|
0a2ca923ee | ||
|
|
5adc4cb437 | ||
|
|
28d4371f4d | ||
|
|
d343bbe1ac | ||
|
|
c6a6163aec | ||
|
|
be60a37a29 | ||
|
|
b3d42866b7 | ||
|
|
9633fb659a | ||
|
|
fab637f5ae | ||
|
|
edcd991659 | ||
|
|
84f41b9c2f | ||
|
|
e7a61f07a2 | ||
|
|
57616ffd83 | ||
|
|
ea002e6634 | ||
|
|
24574360a0 | ||
|
|
e4dff4916b | ||
|
|
bd1ff4c954 | ||
|
|
563c762756 | ||
|
|
6c6bd65969 | ||
|
|
e2dbd5216d | ||
|
|
959a05643f | ||
|
|
3e0f33859a | ||
|
|
b70615c19c | ||
|
|
f6956baf89 | ||
|
|
47cd7cf2a2 | ||
|
|
a1d6d17685 | ||
|
|
fe768a650d | ||
|
|
d9ba282024 | ||
|
|
1b48cc99e5 | ||
|
|
8740e20c90 | ||
|
|
93a2cdf4bf | ||
|
|
0faa4e62f0 | ||
|
|
78e97e9731 | ||
|
|
d59be759bd | ||
|
|
2df78eb436 | ||
|
|
3f132a759f | ||
|
|
b87244bf9a | ||
|
|
6d826001cc | ||
|
|
2de4d36c9f | ||
|
|
ef01212ce8 | ||
|
|
9fa8c36b5f | ||
|
|
a4973616b4 | ||
|
|
a8dd2ed2da | ||
|
|
2766667d16 | ||
|
|
a7e7b9a3ca | ||
|
|
7df272fd4a | ||
|
|
cd694366ed | ||
|
|
4a9fb62663 | ||
|
|
8c7144205b | ||
|
|
f4057d4c2c | ||
|
|
ad5de8c84c | ||
|
|
15f414cae3 | ||
|
|
54d01d2ffd | ||
|
|
f8e87c5aa1 | ||
|
|
090a85bdd5 | ||
|
|
403611443f | ||
|
|
82b14a14e0 | ||
|
|
a0789b45e4 | ||
|
|
12975b1ecf | ||
|
|
59de1212cb | ||
|
|
cc8246b474 | ||
|
|
f13a91e83e | ||
|
|
598aae8ef1 | ||
|
|
fe5414bdf4 | ||
|
|
fd40289887 | ||
|
|
225b8aa63a | ||
|
|
e63bbe734c | ||
|
|
8c76fb6f7c | ||
|
|
617ed0a3cd | ||
|
|
e32e7dd828 | ||
|
|
d6ba027ae7 | ||
|
|
1ea4a7c113 | ||
|
|
8d7e161662 | ||
|
|
332b04d640 | ||
|
|
e7af8305c2 | ||
|
|
edffba3496 | ||
|
|
88834250c5 | ||
|
|
0da15c21e6 | ||
|
|
3076f98127 | ||
|
|
5a7f52b41f | ||
|
|
f403ff7776 | ||
|
|
57998195f6 | ||
|
|
e873150542 | ||
|
|
73440be270 | ||
|
|
e8caa8853e | ||
|
|
4d63643fbf | ||
|
|
c632303fd6 | ||
|
|
06596d8626 | ||
|
|
e0a47b050a | ||
|
|
55bd9bbc7e | ||
|
|
a4c47b920c | ||
|
|
25355596bb | ||
|
|
a40d128704 | ||
|
|
2f0ab09250 | ||
|
|
6be425de4d | ||
|
|
aa55b984a2 | ||
|
|
35725b2324 | ||
|
|
bb4a3487a2 | ||
|
|
2f51f985d8 | ||
|
|
bacdca038e | ||
|
|
f80e190e22 | ||
|
|
024aec1891 | ||
|
|
b80f6cc507 | ||
|
|
be11046cfc | ||
|
|
0a0522d92d | ||
|
|
f436a34474 | ||
|
|
7ab3884cb9 | ||
|
|
b616be8c0e | ||
|
|
65431c462f | ||
|
|
bc6ae0e773 | ||
|
|
5698b2eab9 | ||
|
|
4b1ff7deb5 | ||
|
|
327c0d7a2e | ||
|
|
90522914c0 | ||
|
|
cf44a36153 | ||
|
|
ba23cfdaca | ||
|
|
a85888bcbd | ||
|
|
3d8c25159d | ||
|
|
543f73bf7a | ||
|
|
4130082a8d | ||
|
|
692815713b | ||
|
|
14bef07d25 | ||
|
|
e9c69a118c | ||
|
|
275faea616 | ||
|
|
f4268bb447 | ||
|
|
35eeae7c58 | ||
|
|
ed04df26f8 | ||
|
|
79efaad817 | ||
|
|
1075745439 | ||
|
|
2f7255301d | ||
|
|
fc60d50560 | ||
|
|
488d32974f | ||
|
|
bdd12b262e | ||
|
|
ec8e645679 | ||
|
|
a239c923a3 | ||
|
|
e2fa8b3199 | ||
|
|
2128f46165 | ||
|
|
1378cab008 | ||
|
|
65aca8ab76 | ||
|
|
9db42c9783 | ||
|
|
d9e551031d | ||
|
|
554a163d7d | ||
|
|
858a59568e | ||
|
|
e0eabbebd1 | ||
|
|
1b5c675711 | ||
|
|
bf4daff685 | ||
|
|
d669b19906 | ||
|
|
95e665a917 | ||
|
|
4557094716 | ||
|
|
eb8e585c8c | ||
|
|
5052d1263b | ||
|
|
14bd2c6a3b | ||
|
|
109ee591c1 | ||
|
|
c67cf56dc5 | ||
|
|
727dcc149d | ||
|
|
b450178444 | ||
|
|
23e281689a | ||
|
|
f96eb630d1 | ||
|
|
7cd16c7063 | ||
|
|
4734d2645f | ||
|
|
87a04193f9 | ||
|
|
ea8326ca24 | ||
|
|
5c196d7e47 | ||
|
|
8db1b230d4 | ||
|
|
f92e98d587 | ||
|
|
9b3ed76fb0 | ||
|
|
91780f0b9c | ||
|
|
0f7f7946cd | ||
|
|
c4a0037956 | ||
|
|
586492fc92 | ||
|
|
cfe34628fa | ||
|
|
1e2b7c7e02 | ||
|
|
c12a91ee5f | ||
|
|
c93a2dcb1c | ||
|
|
9baa529200 | ||
|
|
29bf1e5dc4 | ||
|
|
0f1b78e1a5 | ||
|
|
d03820bf91 | ||
|
|
adbf7aeb42 | ||
|
|
c3cadf0db3 | ||
|
|
b57bf29247 | ||
|
|
c5f1289aee | ||
|
|
4a96468e42 | ||
|
|
272c7850d7 | ||
|
|
7466bda816 | ||
|
|
c202399eb6 | ||
|
|
3c046020ef | ||
|
|
d4ffc21a11 | ||
|
|
aefb061f22 | ||
|
|
af3ab140bd | ||
|
|
9d9d43a249 | ||
|
|
5045447bc6 | ||
|
|
a9772dd313 | ||
|
|
675d161df0 | ||
|
|
fe45fd263b | ||
|
|
2e7d8299a1 | ||
|
|
59999abb61 | ||
|
|
23a42b7c48 | ||
|
|
8bda1fe719 | ||
|
|
207e55e869 | ||
|
|
a09b8f1762 | ||
|
|
28f23ae595 | ||
|
|
da0dc31ed0 | ||
|
|
6a9873dbaa | ||
|
|
c68d311f92 | ||
|
|
c148fa9000 | ||
|
|
26fc48ce14 | ||
|
|
0eb7174183 | ||
|
|
248e8750e1 | ||
|
|
6c240fc5d3 | ||
|
|
def3d617b0 | ||
|
|
c49314e755 | ||
|
|
18a80d4fdd | ||
|
|
195e136798 | ||
|
|
606e702e6f | ||
|
|
99d3925b6c | ||
|
|
aed7a6fbf3 | ||
|
|
1d584235e0 | ||
|
|
bbb79bba0f | ||
|
|
731a838c16 | ||
|
|
1a55c472e0 | ||
|
|
222b476d84 | ||
|
|
0e42f31b88 | ||
|
|
d5b3f605f3 | ||
|
|
4e6c354ff9 | ||
|
|
7203165d88 | ||
|
|
17471db248 | ||
|
|
e2cdff3604 | ||
|
|
118b1a039b | ||
|
|
127ead0518 | ||
|
|
ea8119f3ad | ||
|
|
9b0f548336 | ||
|
|
e8a7c15fee | ||
|
|
6055127118 | ||
|
|
81e4a402f2 | ||
|
|
ca975e4f94 | ||
|
|
5bf0f08f25 | ||
|
|
2e06972161 | ||
|
|
d6f26f78a5 | ||
|
|
8eb4c1e7c1 | ||
|
|
3b4f0f67f7 | ||
|
|
bf1436fdff | ||
|
|
0bd47c8c72 | ||
|
|
7599ec6248 | ||
|
|
266df9bf71 | ||
|
|
69b937321c | ||
|
|
ae53634f48 | ||
|
|
09d8e1ce6b | ||
|
|
5751a5c7e5 | ||
|
|
535069587e | ||
|
|
f9550e93d3 | ||
|
|
5318fbaca1 | ||
|
|
5f251c296e | ||
|
|
be7278294a | ||
|
|
291f87e197 | ||
|
|
cca86141fd | ||
|
|
84c4fb825c | ||
|
|
cd9bb16f79 | ||
|
|
79272be631 | ||
|
|
4b9d03fb59 | ||
|
|
3c95e88f08 | ||
|
|
73ed4fa6f3 | ||
|
|
6451f580cb | ||
|
|
dcf8a4948b | ||
|
|
3458cec41e | ||
|
|
809008561f | ||
|
|
72d60e1227 | ||
|
|
8fc335718a | ||
|
|
e6129ad78b | ||
|
|
10802d6a2c | ||
|
|
7b05d26d7e | ||
|
|
fa8d67ebe1 | ||
|
|
0d320c26cd | ||
|
|
96c0276a0e | ||
|
|
3cc5a8ae5c | ||
|
|
0bb15cc6b8 | ||
|
|
5b0ca03640 | ||
|
|
df5abad690 | ||
|
|
549758d789 | ||
|
|
b49a850297 | ||
|
|
5cc1c11f1d | ||
|
|
1e5a596aae | ||
|
|
c63d3a5b61 | ||
|
|
0b8f195249 | ||
|
|
0af08cf578 | ||
|
|
dfe21c5b8c | ||
|
|
f8c5da52f3 | ||
|
|
20752bf48e | ||
|
|
7778790bae | ||
|
|
1b04a50836 | ||
|
|
fccbc90307 | ||
|
|
c5895a7d21 | ||
|
|
9262c8527b | ||
|
|
32484570bb | ||
|
|
f26f6c33d0 | ||
|
|
ec2db0594e | ||
|
|
a6f3f425c3 | ||
|
|
54c1e64739 | ||
|
|
e6e88d2a2b | ||
|
|
7cd229acf0 | ||
|
|
891c540d60 | ||
|
|
ebd8f300d0 | ||
|
|
4566fec58a | ||
|
|
a362206e55 | ||
|
|
a9543e50f2 | ||
|
|
06fc3e726a | ||
|
|
e19a2ac67a | ||
|
|
5e28fb5246 | ||
|
|
2ad9fcf701 | ||
|
|
427b38912f | ||
|
|
5d4619a70a | ||
|
|
5e56f27e45 | ||
|
|
92fca450f1 | ||
|
|
e52f8bbbde | ||
|
|
94c6ccb549 | ||
|
|
a8edd8ffb9 | ||
|
|
52dee04e72 | ||
|
|
e34f030073 | ||
|
|
2b86c24175 | ||
|
|
298768f0cb | ||
|
|
0ba01ddcdd | ||
|
|
abc6ae2dca | ||
|
|
e3d47e1e5d | ||
|
|
17dae79660 | ||
|
|
d6336710b8 | ||
|
|
ed25a4191d | ||
|
|
5723097cbe | ||
|
|
b566098a56 | ||
|
|
f8f34e46e3 | ||
|
|
9227831922 | ||
|
|
625d4c951e | ||
|
|
38b600520f | ||
|
|
0fae016d15 | ||
|
|
5cdc479029 | ||
|
|
d385585291 | ||
|
|
248107bfb8 | ||
|
|
539e336fa1 | ||
|
|
8ab07563e0 | ||
|
|
74b4013002 | ||
|
|
eede8bdc2f | ||
|
|
7db0de7ccc | ||
|
|
487332df40 | ||
|
|
68d156c0e8 | ||
|
|
a9a5622525 | ||
|
|
9e02950844 | ||
|
|
a1730c9524 | ||
|
|
ed3257399b | ||
|
|
763f65cbbe | ||
|
|
364cde1287 | ||
|
|
26675eac64 | ||
|
|
4789be70fc | ||
|
|
2b0168296f | ||
|
|
c532d74f8b | ||
|
|
2a8868e029 | ||
|
|
7410abf895 | ||
|
|
86d0c3bfcb | ||
|
|
fb14747a8b | ||
|
|
2303c54ac5 | ||
|
|
6762ce347d | ||
|
|
2e884339a8 | ||
|
|
3bdb18a2b4 | ||
|
|
aaf2b7e206 | ||
|
|
ef7a711f07 | ||
|
|
d11fbc1069 | ||
|
|
b48d8d4372 | ||
|
|
e257a64772 | ||
|
|
a6b1961d77 | ||
|
|
dc95bad4aa | ||
|
|
327d0277fc | ||
|
|
d363212191 | ||
|
|
266bf202bb | ||
|
|
f280445138 | ||
|
|
fcd93c8db8 | ||
|
|
72add39182 | ||
|
|
d02f0bf5b4 | ||
|
|
509a946c92 | ||
|
|
986734e29b | ||
|
|
147d9dbe83 | ||
|
|
c974853fe8 | ||
|
|
d124f9c8e0 | ||
|
|
cb9222271d | ||
|
|
72505b550d | ||
|
|
b10946f0e8 | ||
|
|
6bcb1ab113 | ||
|
|
9dc22142ef | ||
|
|
e23818b3b4 | ||
|
|
0eef72b6e3 | ||
|
|
00995e3a6a | ||
|
|
089dad31c0 | ||
|
|
b79d36e0eb | ||
|
|
07a78b55cb | ||
|
|
7aa6f8fa9d | ||
|
|
47eaa1ac96 | ||
|
|
0866632b2f | ||
|
|
7500b602dc | ||
|
|
31b341cb68 | ||
|
|
7c62945560 | ||
|
|
59fb3c1dbe | ||
|
|
ea86e2990b | ||
|
|
b2e0ec4130 | ||
|
|
de8a73efb7 | ||
|
|
df95c2c85d | ||
|
|
df322ceacf | ||
|
|
78df3fc12c | ||
|
|
b1a1824522 | ||
|
|
ffab68e809 | ||
|
|
89410cc55d | ||
|
|
9d3b17d86b | ||
|
|
a4a242d58b | ||
|
|
b488764b79 | ||
|
|
38848f43e4 | ||
|
|
9ffea5cadb | ||
|
|
9e05675823 | ||
|
|
3b4efc21a6 | ||
|
|
beaf31ae05 | ||
|
|
631e0b0741 | ||
|
|
553e3b02f5 | ||
|
|
c11db9f0af | ||
|
|
9ce91345a7 | ||
|
|
a6653a3419 | ||
|
|
756f1dd218 | ||
|
|
accf332668 | ||
|
|
8483b0d08e | ||
|
|
b46be2445a | ||
|
|
d45328576f | ||
|
|
a31cc33c67 | ||
|
|
b874147b9c | ||
|
|
4b0b5cb85c | ||
|
|
23ad776a74 | ||
|
|
02cc9ec935 | ||
|
|
1d0c21eff1 | ||
|
|
422c97f681 | ||
|
|
f0d00420c3 | ||
|
|
64c1eac2d0 | ||
|
|
09046ab89e | ||
|
|
ae7c98ce78 | ||
|
|
62bff009c1 | ||
|
|
0c3ea4b05d | ||
|
|
9dde2fbcf8 | ||
|
|
740041a844 | ||
|
|
31bcb8c82d | ||
|
|
425ef9f059 | ||
|
|
e059ecc6c4 | ||
|
|
e04fc7d950 | ||
|
|
97f75fb971 | ||
|
|
425a8c864b | ||
|
|
56c2b1d9b5 | ||
|
|
ab74d19584 | ||
|
|
3e197b72a8 | ||
|
|
863e1a2e20 | ||
|
|
a00c8e0a53 | ||
|
|
3b98206942 | ||
|
|
f6cee7297a | ||
|
|
6792e3d701 | ||
|
|
df1e5aef9b | ||
|
|
6c3d2926b7 | ||
|
|
302fcfc7d7 | ||
|
|
42dd9969e4 | ||
|
|
6a69ce26e3 | ||
|
|
8d6db96a4c | ||
|
|
e61a6bae7e | ||
|
|
37989854a7 | ||
|
|
c70f8441e2 | ||
|
|
f9073055e9 | ||
|
|
a22cdd9553 | ||
|
|
67b8166ebc | ||
|
|
762e498a5c | ||
|
|
48c9862e18 | ||
|
|
a8b7faaed3 | ||
|
|
c56abc020e | ||
|
|
20067b91eb | ||
|
|
43004af842 | ||
|
|
6eb51fdafd | ||
|
|
c3f831727b | ||
|
|
6d328eb376 | ||
|
|
b9424f41ab | ||
|
|
b8aa1af55a | ||
|
|
1ba6e361bd | ||
|
|
0e2c411198 | ||
|
|
ca7917b407 | ||
|
|
69013d2765 | ||
|
|
8a022a2365 | ||
|
|
0d07af4862 | ||
|
|
d5279fb50c | ||
|
|
7d887bdbef | ||
|
|
d688db95e9 | ||
|
|
d12770f97c | ||
|
|
a3d9efbda2 | ||
|
|
3f6479e578 | ||
|
|
9c14b42bda | ||
|
|
5f04224d57 | ||
|
|
5d8d8a5ffe | ||
|
|
9d511e0370 | ||
|
|
37f3bb42a0 | ||
|
|
6af2b098e2 | ||
|
|
a30a0f8d0b | ||
|
|
73d26b45fc | ||
|
|
03d1cc4f78 | ||
|
|
49c89810d8 | ||
|
|
4dc3647370 | ||
|
|
b78c37dbbe | ||
|
|
6ab00e46b2 | ||
|
|
ec22d72f3f | ||
|
|
e7fdb804ae | ||
|
|
6749aee5cd | ||
|
|
c3b846bac7 | ||
|
|
5c9bb477b4 | ||
|
|
97324ce4d4 | ||
|
|
a11d84e812 | ||
|
|
57247cd5cd | ||
|
|
1d7774bcd6 | ||
|
|
415ab6298e | ||
|
|
806a8efe94 | ||
|
|
50925c4c30 | ||
|
|
c9d12184e0 | ||
|
|
b0894b1e75 | ||
|
|
c2781b1f8b | ||
|
|
bd2ccc3612 | ||
|
|
92faccdd90 | ||
|
|
5b42b41dcb | ||
|
|
8a5c429e87 | ||
|
|
194923ca27 | ||
|
|
a2b8391174 | ||
|
|
c0fd535067 | ||
|
|
6629c38d2a | ||
|
|
58032012aa | ||
|
|
7025accd88 | ||
|
|
cc40afcc4d | ||
|
|
3ff2b5f546 | ||
|
|
f5e2309563 | ||
|
|
75aa6d50b3 | ||
|
|
021ad2a5c2 | ||
|
|
ffe486e284 | ||
|
|
6132aa7864 | ||
|
|
56e55d9cd6 | ||
|
|
2f0e91d96e | ||
|
|
32a45ad0d3 | ||
|
|
f0d0d6b73a | ||
|
|
03c470846b | ||
|
|
66f347c973 | ||
|
|
1cf8cae166 | ||
|
|
f2585438bd | ||
|
|
f1e2c5b0d1 | ||
|
|
466ba18ec8 | ||
|
|
844fb2e6ec | ||
|
|
41d8e2a0ae | ||
|
|
49ea016980 | ||
|
|
34a8972ce4 | ||
|
|
a980e1910c | ||
|
|
10758879db | ||
|
|
1e0986b1f6 | ||
|
|
57e16f46ce | ||
|
|
cc076cc803 | ||
|
|
254262c5c4 | ||
|
|
dc8279c3ea | ||
|
|
d34d9316f3 | ||
|
|
7496b1de21 | ||
|
|
27eca480d0 | ||
|
|
311ec1d5df | ||
|
|
a66beecd8d | ||
|
|
f833c8c598 | ||
|
|
828c3b3c9c | ||
|
|
d5f432d07c | ||
|
|
0f8404f686 | ||
|
|
ff46870bf1 | ||
|
|
1b55a5a399 | ||
|
|
afb06cab99 | ||
|
|
d26ac237e9 | ||
|
|
41c200a011 | ||
|
|
fecabca368 | ||
|
|
4afb864bef | ||
|
|
7b8690cbb7 | ||
|
|
9a97b4b754 | ||
|
|
ad4e1f216d | ||
|
|
d6264dfc0b | ||
|
|
675228d841 | ||
|
|
a28567b48a | ||
|
|
317ba23e5a | ||
|
|
26a30da072 | ||
|
|
b35e87780b | ||
|
|
f9aab38575 | ||
|
|
01f8815413 | ||
|
|
963aabb8f5 | ||
|
|
884fe3c7d9 | ||
|
|
8866e2aa13 | ||
|
|
07ac9710a8 | ||
|
|
9177962454 | ||
|
|
a66545dac5 | ||
|
|
0614dcb3e2 | ||
|
|
359d6c4dba | ||
|
|
242018d0d3 | ||
|
|
d9a81d1d14 | ||
|
|
eeb3b70328 | ||
|
|
ca6820f91b | ||
|
|
257eed01df | ||
|
|
f08475605a | ||
|
|
64d480be48 | ||
|
|
f240bca81a | ||
|
|
3b67dc4ac0 | ||
|
|
06fba3a816 | ||
|
|
1586ba83dc | ||
|
|
ab3a5df71d | ||
|
|
9d91629ba7 | ||
|
|
0921d51262 | ||
|
|
4bf898c9d9 | ||
|
|
d346c69033 | ||
|
|
cd68e387c9 | ||
|
|
ee3d51cb84 | ||
|
|
8e584dbe12 | ||
|
|
90f955e471 | ||
|
|
702fc5ac31 | ||
|
|
746a84b50b | ||
|
|
e8cc49fe14 | ||
|
|
f5b9c97edb | ||
|
|
376178b18a | ||
|
|
76521218ae | ||
|
|
f9a9c5c00f | ||
|
|
5779e164c6 | ||
|
|
e17693905a | ||
|
|
92add6b14d | ||
|
|
3493de7bb7 | ||
|
|
c0557f7974 | ||
|
|
f3e8473f60 | ||
|
|
d88a104237 | ||
|
|
932c2162ad | ||
|
|
6f3cdfcc4a | ||
|
|
b311c7991c | ||
|
|
2d25ff399f | ||
|
|
66c78f44c2 | ||
|
|
6f68947815 | ||
|
|
c24460962a | ||
|
|
8a0512c956 | ||
|
|
8f146c5161 | ||
|
|
d5076999fd | ||
|
|
69df0b6837 | ||
|
|
52bef05107 | ||
|
|
261f70c034 | ||
|
|
c5e53125b5 | ||
|
|
304e84f901 | ||
|
|
ed4e4a1d93 | ||
|
|
ae00038493 | ||
|
|
d6a60db1b7 | ||
|
|
a7fa3762aa | ||
|
|
53a2b37c08 | ||
|
|
161f7cd514 | ||
|
|
6816dc772b | ||
|
|
b72df57201 | ||
|
|
1bfdfc4535 | ||
|
|
4149ed361b | ||
|
|
2e1b7e940b | ||
|
|
683c75d308 | ||
|
|
8e8efbb805 | ||
|
|
67da57e7f6 | ||
|
|
1be5f9f748 | ||
|
|
1ee5260d8c | ||
|
|
c017586694 | ||
|
|
ce8df3c833 | ||
|
|
b2a93c04c6 | ||
|
|
2b19ba9572 | ||
|
|
3649ea612f | ||
|
|
4dd9d3b18d | ||
|
|
db307ca37d | ||
|
|
5769927760 | ||
|
|
e827e9be39 | ||
|
|
b799e04c39 | ||
|
|
0a1c45ef3b | ||
|
|
d06b6df34d | ||
|
|
b01854ec72 | ||
|
|
89d2d28ccb | ||
|
|
77f9bd931c | ||
|
|
9ae0779523 | ||
|
|
8d3952fcc9 | ||
|
|
0f759d763d | ||
|
|
22c7ae1053 | ||
|
|
f937aa374f | ||
|
|
2a72cb9700 | ||
|
|
200bc94870 | ||
|
|
168fad78a4 | ||
|
|
741cd4a857 | ||
|
|
68102d1523 | ||
|
|
be72b8c9fd | ||
|
|
0d000cf19b | ||
|
|
0ecf21813e | ||
|
|
e840fbd67d | ||
|
|
e85ea6a3ef | ||
|
|
f80c6ae6f3 | ||
|
|
5050cfa7e8 | ||
|
|
23d87cd926 | ||
|
|
c5a2974d53 | ||
|
|
3aa0736478 | ||
|
|
92f6aab290 | ||
|
|
12322b4be0 | ||
|
|
7a1b0e7a48 | ||
|
|
1914522c3a | ||
|
|
ad07bd9bb9 | ||
|
|
75d2c6686d | ||
|
|
9253b7f841 | ||
|
|
60970134e6 | ||
|
|
ba7136f70a | ||
|
|
dc2c592ee1 | ||
|
|
f910eb7946 | ||
|
|
d72db0db77 | ||
|
|
a251ec7739 | ||
|
|
a55d0e3b04 | ||
|
|
5dc5f31d07 | ||
|
|
f97efabcdb | ||
|
|
ba7995ab3f | ||
|
|
bb1723e2bb | ||
|
|
95866fa5c2 | ||
|
|
8a19456657 | ||
|
|
4e24a9f4dd | ||
|
|
7a5f2412c0 | ||
|
|
cf334b1ea4 | ||
|
|
eb5a723991 | ||
|
|
02e71a79bf | ||
|
|
8eae452765 | ||
|
|
05dea91c93 | ||
|
|
3f4dd04461 | ||
|
|
c2bbf98947 | ||
|
|
65be634999 | ||
|
|
c027648cb7 | ||
|
|
96ff09885d | ||
|
|
cc08b18e9e | ||
|
|
73186a771e | ||
|
|
c7a266cdfc | ||
|
|
a74b749421 | ||
|
|
37a87dbdee | ||
|
|
054b9e3dd2 | ||
|
|
9694eb5940 | ||
|
|
dafb36e3e9 | ||
|
|
364c771b96 | ||
|
|
93ba13b6a9 | ||
|
|
1969ad8dd9 | ||
|
|
0f1713ef32 | ||
|
|
4ddda18d5b | ||
|
|
7df1e92a36 | ||
|
|
998794e11e | ||
|
|
06036c41cd | ||
|
|
cab6b7783b | ||
|
|
8abfe5ff7d | ||
|
|
9ce152bc42 | ||
|
|
fb8ce37e4d | ||
|
|
b16d756941 | ||
|
|
72ad516140 | ||
|
|
56ed695544 | ||
|
|
f567ab8b11 | ||
|
|
968b879b0b | ||
|
|
05ffa8bc03 | ||
|
|
ac4bfcb098 | ||
|
|
2be612e042 | ||
|
|
1b1d7d9481 | ||
|
|
12ab8612cb | ||
|
|
71696ab48b | ||
|
|
6d7e05a9e0 | ||
|
|
82e13c7bed | ||
|
|
df27824e3f | ||
|
|
fac0ccfe68 | ||
|
|
d38536ff75 | ||
|
|
56e0cafe0d | ||
|
|
c55bbe339f | ||
|
|
84ed6cd722 | ||
|
|
dbcf8beda9 | ||
|
|
dbe37d6bc0 | ||
|
|
73b5652b5c | ||
|
|
2fea220ed8 | ||
|
|
8457854483 | ||
|
|
f00ad62b96 | ||
|
|
cd65f4c4d7 | ||
|
|
f9f4c59e55 | ||
|
|
402505e2cb | ||
|
|
4b13e4f7c6 | ||
|
|
d0e9cc44e0 | ||
|
|
9af4e0e15e | ||
|
|
c2f77ba39f | ||
|
|
7db4e397f0 | ||
|
|
399db108f3 | ||
|
|
9de5e5f984 | ||
|
|
30505269a6 | ||
|
|
7b1f1268fc | ||
|
|
fd23957e2e | ||
|
|
98dc5890fd | ||
|
|
4a1eeeedd1 | ||
|
|
bf3d11cbdc | ||
|
|
4e055a3eb0 | ||
|
|
e703f220ca | ||
|
|
9e4ec60d47 | ||
|
|
6ea960f2b7 | ||
|
|
2d98d34137 | ||
|
|
42c2aec975 | ||
|
|
b0f062234b | ||
|
|
16b3cb581b | ||
|
|
65e5bc8da0 | ||
|
|
82815cd697 | ||
|
|
87cabfeaeb | ||
|
|
4dcd5712e8 | ||
|
|
04a63d5e17 | ||
|
|
6b330eccef | ||
|
|
3b5a0a3067 | ||
|
|
9c9c216f6c | ||
|
|
e4cdecf653 | ||
|
|
544e11ac9c | ||
|
|
3fe6f27c57 | ||
|
|
c35a911d36 | ||
|
|
e7bb823677 | ||
|
|
f79d7b8550 | ||
|
|
11e5ebeacf | ||
|
|
2ed3da2328 | ||
|
|
3d0a30e38c | ||
|
|
a8a8cd8158 | ||
|
|
b518520dd6 | ||
|
|
9e7662c255 | ||
|
|
0b70872163 | ||
|
|
cc3999e9f6 | ||
|
|
aa3e137c9a | ||
|
|
c5dbf2d54d | ||
|
|
5770cfad3b | ||
|
|
9204ffae78 | ||
|
|
5340ea400c | ||
|
|
990ccee91d | ||
|
|
837885cb04 | ||
|
|
af00609edc | ||
|
|
8cf974701a | ||
|
|
82cd586950 | ||
|
|
e7f74373dd | ||
|
|
a9bb8f7130 | ||
|
|
68a084911d | ||
|
|
d02bb86083 | ||
|
|
408291403b | ||
|
|
5afe8d2805 | ||
|
|
1482b65c64 | ||
|
|
84173e2933 | ||
|
|
a0bd0c422e | ||
|
|
6ebbc369ca | ||
|
|
72fa14cb8f | ||
|
|
7bed153cc8 | ||
|
|
07f0ccacb6 | ||
|
|
b95f75354e | ||
|
|
15bf587616 | ||
|
|
e6dc1b5b09 | ||
|
|
0839b06ec2 | ||
|
|
67e9410f43 | ||
|
|
789409f74f | ||
|
|
141d588596 | ||
|
|
3a6a11bab3 | ||
|
|
bc17f8c865 | ||
|
|
9b434d4928 | ||
|
|
56bbe64b35 | ||
|
|
5504e0e7b7 | ||
|
|
890c211fe2 | ||
|
|
14be61b5d8 | ||
|
|
5455689f9b | ||
|
|
68e10ea066 | ||
|
|
c2d3a2d94f | ||
|
|
3905b9e089 | ||
|
|
ce15caed4f | ||
|
|
1c51219f40 | ||
|
|
85d8446e93 | ||
|
|
83b5812ade | ||
|
|
488e26af6d | ||
|
|
41549ae60d | ||
|
|
1ede748d81 | ||
|
|
5913ba9491 | ||
|
|
caaad2da85 | ||
|
|
143318dd34 | ||
|
|
1d48e27c80 | ||
|
|
c6ea09a031 | ||
|
|
d75eca55ad | ||
|
|
e8432d0000 | ||
|
|
276f9dbfdb | ||
|
|
cf1a5ba382 | ||
|
|
c551db1556 | ||
|
|
0caf3ea31a | ||
|
|
a1bd6e34cc | ||
|
|
c8d1c60bd8 | ||
|
|
41b2f64db4 | ||
|
|
3fc011e75e | ||
|
|
42a31a4479 | ||
|
|
b044ff5f35 | ||
|
|
843463a97f | ||
|
|
c14765f69d | ||
|
|
35e1b194c1 | ||
|
|
912c2aeb03 | ||
|
|
25eeea20c7 | ||
|
|
67f5964aff | ||
|
|
0bf7933d4d | ||
|
|
c5e868dc1b | ||
|
|
5f7e80643a | ||
|
|
bcd85eec82 | ||
|
|
55667b78df | ||
|
|
0ac429a0b6 | ||
|
|
bbc51b83b8 | ||
|
|
d0c709fa2f | ||
|
|
0dfcbb778b | ||
|
|
6ed70380b6 | ||
|
|
4d844a1608 | ||
|
|
9af650def7 | ||
|
|
1935bbf510 | ||
|
|
eadfd7fd48 | ||
|
|
1c33ad4527 | ||
|
|
ac6cc76d67 | ||
|
|
6adc8014da | ||
|
|
138df7c2c0 | ||
|
|
efb8cbc9f4 | ||
|
|
f0d03f2196 | ||
|
|
ed4077b1ff | ||
|
|
20fe982df2 | ||
|
|
25c33b69f3 | ||
|
|
722c8f38d1 | ||
|
|
3bb01d8eaf | ||
|
|
d4d7c64442 | ||
|
|
4c559f20a3 | ||
|
|
81fa1bc43f | ||
|
|
0c63f37a8e | ||
|
|
90d20b7e1a | ||
|
|
1cad2a94ec | ||
|
|
92d95bd585 | ||
|
|
39da7cbe22 | ||
|
|
061c603831 | ||
|
|
8fb92a316a | ||
|
|
527a571bf6 | ||
|
|
b2e81e3070 | ||
|
|
1a389d68c5 | ||
|
|
5908b4aaf2 | ||
|
|
684781aadd | ||
|
|
2b771772e2 | ||
|
|
ff439a2b0b | ||
|
|
ea8bcae586 | ||
|
|
3e7fff0c35 | ||
|
|
81bd3b4893 | ||
|
|
68e9842bd9 | ||
|
|
54552031d8 | ||
|
|
bfabccc60d | ||
|
|
17fe1df029 | ||
|
|
e10ccea86c | ||
|
|
fa470bd8bf | ||
|
|
9b7a2cda15 | ||
|
|
d0d60d26da | ||
|
|
b2c14c1218 | ||
|
|
2d59dc2c72 | ||
|
|
bb48cdf0a0 | ||
|
|
e00dcbcd92 | ||
|
|
5ab7d6e94e | ||
|
|
d1da9adc88 | ||
|
|
1455babd62 | ||
|
|
fc8529323c | ||
|
|
f9130794ee | ||
|
|
e62d6c0edd | ||
|
|
8d1dc4b090 | ||
|
|
acf6cf6ea2 | ||
|
|
d9ee44f90a | ||
|
|
bd6da5db9a | ||
|
|
4b3ade9b48 | ||
|
|
9daed7e0d4 | ||
|
|
4ef61e7af1 | ||
|
|
851f2d0517 | ||
|
|
5e5e04de8e | ||
|
|
e8b2f952af | ||
|
|
85b5d10e5a | ||
|
|
b916ca7bfb | ||
|
|
46190154f6 | ||
|
|
194552d2d3 | ||
|
|
a736cbc4d5 | ||
|
|
0310ecdfd0 | ||
|
|
28bbc8bbe9 | ||
|
|
f36ef66623 | ||
|
|
16ba51aa8c | ||
|
|
52847d1fad | ||
|
|
4733cc8a3e | ||
|
|
aecf61135f | ||
|
|
252d86eb70 | ||
|
|
438b0fe9d3 | ||
|
|
f6c58b5a28 | ||
|
|
dee2f94c38 | ||
|
|
1fc4dec5ca | ||
|
|
d7ab12bc61 | ||
|
|
1f50612a16 | ||
|
|
43715f1e34 | ||
|
|
1bf0ff69d8 | ||
|
|
abf992dfb8 | ||
|
|
707dfee696 | ||
|
|
e8c4f059c0 | ||
|
|
1a6f80f2df | ||
|
|
47ae310ac7 | ||
|
|
923c61f9c7 | ||
|
|
18b8c558cd | ||
|
|
84a091e380 | ||
|
|
1399098e30 | ||
|
|
593f8add5d | ||
|
|
2f26624f29 | ||
|
|
14c901d219 | ||
|
|
2b2e45ca45 | ||
|
|
868e9a322e | ||
|
|
d2f3f58de1 | ||
|
|
a69b3fcd11 | ||
|
|
a3505ee7f2 | ||
|
|
efe5e0e2c4 | ||
|
|
8745527c5d | ||
|
|
78b40df71e | ||
|
|
9675619ab9 | ||
|
|
68ca2c2be6 | ||
|
|
835ecbb410 | ||
|
|
22756a3c13 | ||
|
|
3c2fb04ed8 | ||
|
|
db5fb840a6 | ||
|
|
65b05d707b | ||
|
|
1b972df7e2 | ||
|
|
40266c275d | ||
|
|
197db35c80 | ||
|
|
8771e1ace7 | ||
|
|
e6e1275ad2 | ||
|
|
417dc0859b | ||
|
|
806e1f29bb | ||
|
|
9724f5769d | ||
|
|
5a0c8914c4 | ||
|
|
c2e0a30da8 | ||
|
|
45ae4f20a0 | ||
|
|
398826d7ef | ||
|
|
14e5f3bf74 | ||
|
|
57b1cbf41b | ||
|
|
51a0d88b9b | ||
|
|
16d4d7d1ea | ||
|
|
2affb1513d | ||
|
|
214d4b2a9e | ||
|
|
2f486d979b | ||
|
|
023c5fb99a | ||
|
|
329ed371f9 | ||
|
|
0577bfbde3 | ||
|
|
3ce5c35143 | ||
|
|
9258ef4bb3 | ||
|
|
e02facc170 | ||
|
|
4dc76926ea | ||
|
|
ba6be7e987 | ||
|
|
6b2da1ec97 | ||
|
|
6aa1b515c7 | ||
|
|
5d64ec1c8f | ||
|
|
e1b81fb931 | ||
|
|
c91752598c | ||
|
|
708515925f | ||
|
|
a61745f868 | ||
|
|
2ca7af34df | ||
|
|
bd7e6f4e3e | ||
|
|
32e86d461e | ||
|
|
66ea5ad979 | ||
|
|
ebfa80d444 | ||
|
|
4247cc819d | ||
|
|
1f9f5bd734 | ||
|
|
426d791eea | ||
|
|
30d99b812c | ||
|
|
981e55bc4d | ||
|
|
bab1090a25 | ||
|
|
84b5181fd8 | ||
|
|
222ebb58c0 | ||
|
|
f5ad3a6a2e | ||
|
|
422af60827 | ||
|
|
9127321540 | ||
|
|
dcae059480 | ||
|
|
6d6603e013 | ||
|
|
90fe8078c3 | ||
|
|
367fb32114 | ||
|
|
b2b82afd71 |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -37,6 +37,7 @@ nosetests.xml
|
||||
|
||||
# PyCharm
|
||||
.idea
|
||||
/.eggs
|
||||
|
||||
# OSX
|
||||
.DS_Store
|
||||
@@ -47,3 +48,13 @@ nosetests.xml
|
||||
|
||||
# Gedit Temp Files
|
||||
*~
|
||||
|
||||
# Qt creator
|
||||
*.autosave
|
||||
|
||||
# Licence keys
|
||||
keys
|
||||
|
||||
# Custom config
|
||||
/gns3_server.ini
|
||||
updates
|
||||
|
||||
41
.travis.yml
41
.travis.yml
@@ -1,24 +1,37 @@
|
||||
language: python
|
||||
|
||||
#New container architecture
|
||||
#http://docs.travis-ci.com/user/workers/container-based-infrastructure/
|
||||
#sudo: false
|
||||
|
||||
python:
|
||||
- "3.3"
|
||||
- "3.4"
|
||||
|
||||
install:
|
||||
- "pip install -r requirements.txt --use-mirrors"
|
||||
- "pip install tox"
|
||||
cache:
|
||||
apt: true
|
||||
directories:
|
||||
- build
|
||||
|
||||
script: "python setup.py test"
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
before_install:
|
||||
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install qtbase5-dev qtdeclarative5-dev libqt5webkit5-dev libsqlite3-dev
|
||||
- sudo apt-get install qt5-default qttools5-dev-tools
|
||||
- sh scripts/prepare_travis.sh
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels:
|
||||
- "chat.freenode.net#gns3"
|
||||
on_success: change
|
||||
on_failure: always
|
||||
#email:
|
||||
# - julien@gns3.net
|
||||
#irc:
|
||||
# channels:
|
||||
# - "chat.freenode.net#gns3"
|
||||
# on_success: change
|
||||
# on_failure: always
|
||||
|
||||
install:
|
||||
- "pip install -r dev-requirements.txt"
|
||||
|
||||
script:
|
||||
- "xvfb-run py.test -vv" # Run tests in a fake X server
|
||||
# - "pep8 --exclude=build,.git,ui"
|
||||
|
||||
445
CHANGELOG
Normal file
445
CHANGELOG
Normal file
@@ -0,0 +1,445 @@
|
||||
# Change Log
|
||||
|
||||
## 1.4.0alpha2 22/07/2015
|
||||
|
||||
* Cloud support with the GNS3 VM.
|
||||
* Display an error message when Qemu binaries cannot be retrieved in the Qemu VM configuration page.
|
||||
* Remove default FLASH when no hda disk for Qemu VMs. Fixes #535.
|
||||
* Use the registry to find vmrun if the default VMware install path doesn't exist. Fixes #546.
|
||||
* Avoid the creation of a NIO when one has been cancelled.
|
||||
* Fix Crash with chinese characters
|
||||
* Display an error if terminal command is invalid
|
||||
* Prevents "Show in File Manager" to be used with generic switches.
|
||||
* Remove unused dependencies
|
||||
* Drop PyQt4 support and show an error for users
|
||||
* Fixes symbol for VM template gone after restart. Fixes #538.
|
||||
* Fix VirtualBox GNS3 VM
|
||||
* Fix issue with remote server not saved/migrated
|
||||
* Remove ram as a mandatory dynamips settings
|
||||
* Force UTF-8 when reading server configuration file
|
||||
|
||||
## 1.4.0alpha1 09/07/2015
|
||||
|
||||
* Remove unused cloud code from the 1.4
|
||||
* Setup Wizard (to be tweaked). Implements #402.
|
||||
* Adds -no-kvm to the ASA template and ignore -no-kvm on platforms other than Linux. Should resolve #472.
|
||||
* Explicitly set the acceleration method to tcg for ASA templates. Should resolve #472.
|
||||
* Show an error if the console port range overlaps the default VNC port range (5900 to 6000) in the server preferences.
|
||||
* Support self update of the application
|
||||
* Option to adjust the local server IP address to be in the same subnet as the GNS3 VM.
|
||||
* Warning about deprecated ASA on Qemu
|
||||
* Moves KVM setting to Qemu preferences.
|
||||
* VNC console support for Qemu VMs. Implements #447.
|
||||
* Change the location of the config file on OSX
|
||||
* Adds first port name option (for management interfaces). Completes #309.
|
||||
* Add a force quit button when closing the app
|
||||
* Basic auth support for remote servers
|
||||
* Adds symbol overview in tooltips for all symbol text fields.
|
||||
* Remove SVG icons used in hover events.
|
||||
* Support for custom symbols
|
||||
* RAM usage based load balancing. #419.
|
||||
* Creates a new "Servers" config section and moves "LocalServer", "RemoteServers" and "GNS3VM" under it.
|
||||
* Support spaces in the local server log path.
|
||||
* Round-Robin load balancing support. #419.
|
||||
* Auto upload image if missing on remote server
|
||||
* ACPI shutdown support for VMware VMs. Fixes #436.
|
||||
* Add timestamps to gns3_gui.log
|
||||
* Store MD5 of images in topology
|
||||
* SSL support
|
||||
* GNS3 VM support
|
||||
* Add a specific icon for VPCS
|
||||
* Ensure no colored log output on Windows
|
||||
* Enable KVM acceleration option.
|
||||
* Apply the result of the auto Idle-PC feature to other routers with the same IOS image.
|
||||
* Improve config change autodetect
|
||||
* Show in file manager (#260: to complete using the VM directory instead).
|
||||
* Open/save dialog is opened in project folder when importing/exporting configs. Fixes #299.
|
||||
* IPv6 support.
|
||||
* Import/Export support for IOU nvrams.
|
||||
* Option to drop nvram & disk files for IOS routers in order to save disk space.
|
||||
* Fix IOU server edit
|
||||
* JSON schema for checking topologies
|
||||
* Support for base MAC address for Qemu VMs.
|
||||
* Drop Python 3.3
|
||||
* ACPI shutdown support for Qemu VMs.
|
||||
* ACPI shutdown support for VirtualBox VMs.
|
||||
* Rename node configurator to node properties.
|
||||
* Merge pull request #381 from GNS3/doubleclick_label
|
||||
* If you doubleclick on a label we open the change hostname dialog
|
||||
* Fix GNS3 server location for OSX
|
||||
* Serial console implementation for VMware VMs.
|
||||
* Ubridge configuration support.
|
||||
* Adds a wizard for creating images with qemu-img and mofified qemu configuration page to use it.
|
||||
* Download remote project with md5 support
|
||||
* SSH support
|
||||
* Avoid moving .gns3_temporary files.
|
||||
* New inline help text for the idle-pc dialog.
|
||||
* Add support for IOS-XRv under qemu wizard.
|
||||
* Upload images from gui
|
||||
* Text can now has an alpha channel, allowing for transparent or semi-transparent text.
|
||||
* The device list in the configuration dialog is hidden by default when only one device is selected.
|
||||
* Adds multi select support in all device template pages.
|
||||
* Adjusted the double click action so that a click on a stopped node opens the configuration dialog with all selected nodes and a double click on a started node consoles to all selected devices.
|
||||
* VMware support for Windows and Linux
|
||||
* Listen for notifications from servers.
|
||||
* Migration to QT5
|
||||
* Wireshark remote packet capture
|
||||
|
||||
## 1.3.7 22/06/2015
|
||||
|
||||
* Makes sure Hub Ethernet port names are string.
|
||||
* Support spaces in the local server log path.
|
||||
* Fixes issue when setting the local server settings.
|
||||
* Fix a crash with Python 3.3
|
||||
* Fixes WICs are not displayed correctly. Fixes #434.
|
||||
* Do not load settings that the GUI doesn't use.
|
||||
|
||||
## 1.3.6 16/06/2015
|
||||
|
||||
* Fix an issue with 1.4dev compatibility
|
||||
|
||||
## 1.3.5 16/06/2015
|
||||
|
||||
* Do not crash in a very rare case on Windows when stoping local server
|
||||
* Escape usage to glob
|
||||
* Fix QMessageBox.NoButton): argument 1 has unexpected type 'Servers'
|
||||
* Turn on/off local server auth
|
||||
* Fix 'ValueError' object has no attribute 'errno' in IOS decompress
|
||||
* Fix error if communication with the update server is intercepted by a third party.
|
||||
* Fix auth errors if you change the local server IP
|
||||
* Support auth for local server
|
||||
* Ensure no colored log output on Windows
|
||||
* Fixes issue with default router settings for templates.
|
||||
* Display a proper message if you use a remote server started with --local
|
||||
* Catch zlib error when uncompress IOS
|
||||
* Raise error if we pass non string to Port name
|
||||
* Add basic auth support for local server
|
||||
|
||||
## 1.3.4 02/06/2015
|
||||
|
||||
* Check if an IOS image is set in the IOS router template
|
||||
* Ensure the version number is written in configuration file
|
||||
* Prevent users to add links to running Qemu VMs and start a capture on running VirtualBox VMs.
|
||||
* Fix resize issue in server page
|
||||
* Fix segfault when starting OSX server with allow connection from anywhere
|
||||
* Fixes bug when editing c7200 templates.
|
||||
* Fixes IOS decompression. Fixes #370.
|
||||
* Topology auto start work for VPCS
|
||||
* Avoid moving .gns3_temporary files.
|
||||
* Handles MemoryError.
|
||||
* Fix crash when a process listen on GNS3 port return an empty JSON
|
||||
* Another fix for the topology None error
|
||||
* Fix a rare crash in completion
|
||||
* Fix crash when loading topology in rare conditions
|
||||
|
||||
## 1.3.3 14/05/2015
|
||||
|
||||
* New inline help text for the idle-pc dialog.
|
||||
* Reactivate auto idle-pc in device contextual menu + save a chosen idle-pc value in template.
|
||||
* Adds name to the thank you section.
|
||||
* Prevent users to use VirtualBox linked clone VMs in temporary projects (for now).
|
||||
* Capture error if the command is invalid
|
||||
* Cleanup egg cache when exit
|
||||
* Fix a crash in console when you used non UTF-8 terminal
|
||||
* Fix crash during save as
|
||||
* Change title when exporting an IOS startup-config.
|
||||
* Removes analytics client on closing.
|
||||
|
||||
## 1.3.3rc1 07/05/2015
|
||||
|
||||
* Catch broken pipe error catched for OSX
|
||||
* Prevent a topology made for next version to be open in previous version
|
||||
* Check if the local server is really a local server
|
||||
* NIO NAT support for QEMU VMs (user mode back-end is used).
|
||||
* Modified version requirements, so that they require the dependency versions as minimums. Added some more detailed instructions for compilation on Windows.
|
||||
* Prevent user to enter a None port
|
||||
* Fix broken pipe error on OSX when frozen
|
||||
* Prevent the same link created twice on OSX
|
||||
* Project loading: names and IDs must be assigned to ports on the client side after nodes have been created. Fixes #326. Fixes config updating for IOS router and IOU devices.
|
||||
* Fix a crash when dropping a .gns3
|
||||
* Cleanup VPCS code
|
||||
* Turn off config parser interpolation
|
||||
* Support unicode characters in regex
|
||||
* Fixes duplicate entries for "Recent files" on Windows. Fixes #316.
|
||||
* Fixes VPCS multi-host. Fixes #318.
|
||||
* Fixes issues when importing configs for IOS, IOU and VPCS. Fixes #314.
|
||||
* Fixes issue when console setting present in IOS router templates.
|
||||
* Do not send empty settings when creating VMs.
|
||||
* Do not set a default private-config when creating a new IOS router template. Fixes #317.
|
||||
* Refactors how startup-config and private-config are handled for IOS routers.
|
||||
* Fixes IOU and QEMU tests.
|
||||
* Makes sure all IOS router settings are saved in the project file & simplify loading from a project.
|
||||
* Makes sure all VirtualBox VM settings are saved in the project file & simplify loading from a project.
|
||||
* Makes sure all VPCS VM settings are saved in the project file & simplify loading from a project.
|
||||
* Makes sure all IOU VM settings are saved in the project file & simplify loading from a project.
|
||||
* Makes sure all QEMU VM settings are saved in the project file & simplify loading from a project.
|
||||
* Fix save as by correctly renaming VM uuid project directory
|
||||
* Fix save as duplicate the .gns3 file
|
||||
* Fix broken project in Another assert topology fixe
|
||||
* Prevent user to enter bad hostname
|
||||
* Fixes an issue when the IOU VM template has a console setting.
|
||||
* Releasing adding a link. Fixes #235.
|
||||
* Fix RuntimeError: wrapped C/C++ object of type QNetworkReply has been deleted.
|
||||
* Do not crash if terminal doesn't support UTF-8
|
||||
* Fix windows build
|
||||
* Fixes "show only devices with captures" in the topology summary.
|
||||
|
||||
## 1.3.2 28/04/2015
|
||||
|
||||
* Fixes bug when IOS configs are not in VM settings.
|
||||
* Fixes small issue with Qemu VM monitor.
|
||||
* Fixes issue when only one port is added after a QEMU VM is created. Fixes #296.
|
||||
* Avoid Cygwin warning with VPCS on Windows.
|
||||
* Fixes issues with QThread handling.
|
||||
* Fixes missing title + icon in layer position warning message box.
|
||||
* Allows the warning message box to be displayed once only when moving an object to a background layer.
|
||||
* Fixes small issue with old monitor setting.
|
||||
* Check the config path is set when creating a IOU or IOS router.
|
||||
* Removes residual link when a NIO cannot be created on the server. Fixes #294.
|
||||
* Fix VPCS tests
|
||||
* Do not crash if an antivirus intercept a message and send non UTF-8
|
||||
* Avoid C++ runtime error when progress dialog is finished.
|
||||
* Merge remote-tracking branch 'origin/master'
|
||||
* Move FileCopyThread to FileCopyWorker.
|
||||
* If project loading fail fallback to real temporary project
|
||||
* Do not crash if rotation is a string
|
||||
* I think it's prevent empty topologies
|
||||
* Explicit utf-8 decoding.
|
||||
* Fixes rare maximum recursion depth exceeded exception.
|
||||
* Check for invalid base VM configuration files.
|
||||
* Catch ValueError exception thrown by mmap(): cannot mmap an empty file.
|
||||
* Use QThreads the correct way (moveToThread).
|
||||
* Fixes broken serial console connection.
|
||||
* Fixes "RuntimeError: wrapped C/C++ object ... has been deleted" exceptions with item links.
|
||||
* Allows exported config files to be created even when there is no config set on VMs.
|
||||
* Do not try to export empty VPCS startup configs.
|
||||
* Prevent issues when a file with a simple number is considered valid JSON.
|
||||
* Explicit error when mmap throw an invalid argument exception.
|
||||
* Do not replace invalid utf-8 characters when reading the iourc file (we catch the exception to tell the user this is an invalid file).
|
||||
* Explicit utf-8 encoding where necessary to avoid Unicode errors on Windows (we require/set an utf-8 locale on other systems).
|
||||
* Save as dialog opens in the projects directory. Fixes #267.
|
||||
* Adds Terminal + nc for serial console connections on OSX. Fixes #228.
|
||||
* Improve warning when non unicode char in iourc
|
||||
* Crash report not for developers and new key
|
||||
* Do not crash if we can't change IOU permission
|
||||
* More checks when decompressing IOS images.
|
||||
* Warn users that they must provide their router images.
|
||||
* Display an error and link to the documentation if no router available
|
||||
* Display print( in std console and Qt Console
|
||||
* Fix tests and a potential issue where initial_content is not send
|
||||
* Fix a crash in qemu loading
|
||||
* Removes unnecessary progress dialog when listing VirtualBox VMs.
|
||||
* Fixes issues when pushing configs for Dynamips and IOU.
|
||||
* Allow for empty initial-config path for IOU VM templates. Send IOU VM settings while creating it (POST) and not using the update API call immediately after (PUT).
|
||||
* Allow for empty startup-config and private-config paths for IOS routers.
|
||||
* Send QEMU VM settings while creating it (POST) and not using the update API call immediately after (PUT).
|
||||
* Include resources and tests in pypi packages
|
||||
* Fix issue during project import on Windows with non local server
|
||||
|
||||
## 1.3.1 11/04/2015
|
||||
|
||||
* Release
|
||||
|
||||
## 1.3.1rc4 09/04/2015
|
||||
|
||||
* Fix crash when save as can't create a directory
|
||||
* Allow less strict dependencies
|
||||
|
||||
## 1.3.1rc3 07/04/2015
|
||||
|
||||
* Send HTTP errors 400 to the crash report system
|
||||
|
||||
## 1.3.1rc2 06/04/2015
|
||||
|
||||
* Fix race condition during old project import
|
||||
|
||||
## 1.3.1rc1 05/04/2015
|
||||
|
||||
* Fix rare occasion when user manage to put text in port field
|
||||
* Fix a crash when exporting vpcs startup script
|
||||
* Fix an issue with sending iourc when a topologies is reloaded
|
||||
* Solve issue when iourc contains non ascii characters
|
||||
* Handle corrupted zip file with IOS image
|
||||
* Don't crash if we try to contact a non GNS3 remote server returning JSON
|
||||
* Skip tests in package
|
||||
* Check port range
|
||||
* Add a warning about too much ram for IOS
|
||||
* Fix crash if project is already closed
|
||||
* Check if wait for connection thread still running before emitting a signal.
|
||||
* Check if process files thread still running before emitting a signal.
|
||||
* Raven is an optionnal dependencies for Debian
|
||||
* Fix crash if a dumped topology as no node during save as
|
||||
* Fix: remove old ID references for ATM and Frame-Relay switches.
|
||||
|
||||
## 1.3.0 30/03/2015
|
||||
|
||||
* Fix etherswitch router
|
||||
* Fix issues with progress dialog
|
||||
* Fix save as
|
||||
|
||||
## 1.3.0rc2 23/03/2015
|
||||
|
||||
* Fix crash when in same occasion the project name is missing
|
||||
* Update sentry key
|
||||
* Display adapters in the tooltips in the correct order.
|
||||
* Open consoles in alphanumerical order.
|
||||
* Auto idle-PC improvements.
|
||||
* Adds project id when requesting UDP port.
|
||||
* Fixes Thread problem. Fixes #229.
|
||||
* Cancel network requests if the progress dialog itself is canceled. Avoid closing the preferences dialog or any configuration dialog if there is a pending request. Fixes #227.
|
||||
* Fixes #228 (no alternative interface has been chosen).
|
||||
* Catch OSError when reading or writing the local server config file.
|
||||
* Fixes GUI that could not be closed when using an already running local server.
|
||||
* Save configs when project is committed.
|
||||
* Del key deletes selected link
|
||||
* Fix crash is no remote servers is available
|
||||
|
||||
## 1.3.0rc1 19/03/2015
|
||||
|
||||
* Handle legacy snapshots
|
||||
* Add server informations for Qemu, VirtualBox and VPCS info boxes
|
||||
* Support sending IOURC from client to remote servers
|
||||
* Fixes crash when quick restart the client
|
||||
* Add 1MB disk for EtherSwitch router templates (to store the vlan database)
|
||||
* Fixes alignment options to ignore devices labels
|
||||
* Compute IDLEPC on remote servers
|
||||
* Prevent using lab instruction in a temporary project
|
||||
* Display a warning on console if server port is already in used
|
||||
* Display an error if server version is incorrect
|
||||
|
||||
## 1.3.0beta2 13/03/2015
|
||||
|
||||
* Alternative local server shutdown (faster GUI closing on Windows).
|
||||
* Grey out local server preferences if the local server is not activated.
|
||||
* Adds "template" to the Wizard titles.
|
||||
* Option to automatically take or not a screenshot when saving a project.
|
||||
* Support RAM setting for VirtualBox VMs.
|
||||
* Fixed duplicate VM template entries for Qemu, VirtualBox and IOU.
|
||||
|
||||
## 1.3.0beta1 11/03/2015
|
||||
|
||||
* New title for VMs/Devices/routers preference pages.
|
||||
* Deactivate auto idle-pc in contextual menu while we think about a better implementation.
|
||||
* Optional IOU license key check.
|
||||
* Relative picture paths are saved in projects.
|
||||
* Relative path support of IOU, IOS and Qemu images.
|
||||
* More checks when automatically starting the local server and find an alternative port if needed.
|
||||
* Support for HDC and HDD disk images in Qemu.
|
||||
* Fixed base IOS and IOU base configs.
|
||||
* Fixed GNS3 console issues.
|
||||
* Renamed server.conf and server.ini to gns3_server.conf and gns3_server.ini respectively.
|
||||
* Remove remote servers list from module preferences + some other prefences re-factoring.
|
||||
* Automatically convert old projects on remote servers.
|
||||
* Bump the progress dialog minimum duration before display to 1000ms.
|
||||
* Fixed port listing bug with Cloud and Host nodes.
|
||||
* Fixed Qemu networking.
|
||||
* Give a warning when a object is move the background layer.
|
||||
* Option to draw a rectangle when a node is selected.
|
||||
* New project icon (little yellow indicator).
|
||||
* Default name for screenshot file is "screenshot".
|
||||
* Alignment options (horizontal & vertical).
|
||||
* Fixed import / export of the preferences file.
|
||||
* Fixed pkg_ressource bug.
|
||||
* Brought back Qemu preferences page.
|
||||
* Include SSL cacert file with GNS3 Windows exe and Mac OS App to send crash report using HTTPS.
|
||||
* Fixed adapter bug with VirtualBox.
|
||||
* Fixed various errors when a project was not initialized.
|
||||
|
||||
## 1.3.0alpha1 03/03/2015
|
||||
|
||||
* No more console port and UDP tunneling settings by type of module
|
||||
* Fixe save
|
||||
* Settings are stored as JSON
|
||||
* All communication with servers display a waiting dialog
|
||||
* Add a revision number in the topology file
|
||||
* Qemu can run on a server without graphical interface
|
||||
* Automated crash reports
|
||||
* You can now copy paste from the GNS 3 console
|
||||
|
||||
|
||||
## 1.2.3 2015/01/17
|
||||
|
||||
* Fixed temporary files path setting in general preferences which was not used.
|
||||
* Fixed missing devices from the node view when they use a remote server.
|
||||
* Fixed broken ASA kernel/initrd file browsers.
|
||||
* Fixed bug with WICs interfaces no showing up in the port list.
|
||||
|
||||
## 1.2.2 2015/01/16
|
||||
|
||||
### Small improvements / new features
|
||||
|
||||
* EtherSwitch routers can be added and configured like other IOS routers.
|
||||
* Change hostname option in the contextual device menu.
|
||||
* Import & export config options in contextual device menu.
|
||||
* Auto screenshot when saving a project.
|
||||
* Auto start project support (you have to manually edit your .gns3 project file).
|
||||
* Changes to the IOU L2 initial-config (16 Ethernet interfaces, no shutdown by default and 0 serial interfaces).
|
||||
* Upgraded SuperPutty to version 1.4.0.5 in the all-in-one installer.
|
||||
* Possibility to apply or not the same text to all selected items when editing notes.
|
||||
* Base configs are now stored in the GNS3 config directory.
|
||||
* Short port names in the topology summary.
|
||||
* Added the VirtualBox VM name in VirtualBox device tooltips.
|
||||
* Set 5 seconds timeout for local server connections.
|
||||
* Check if any device runs and warn the user before closing a project.
|
||||
* Restore the debug level status when starting.
|
||||
* Automatically select the symbol and category corresponding the edited item in the symbol selection dialog.
|
||||
* Scale SVG images to icon sizes.
|
||||
* Console switching from local/remote to remote/local while a VirtualBox VM is running.
|
||||
* Default Jungle dock location is now bottom right corner.
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* Fixed the default jungle news loading on Windows.
|
||||
* Fixed SuperPutty integration (not the default, still have to select it in the preferences).
|
||||
* Avoid uninitialized nodes to be saved in the project file.
|
||||
Prevent GNS3 to crash on Windows when importing GNS3 config file.
|
||||
* Fixed resource access on Mac OS X.
|
||||
* Fixed transparency or border style restoration for ellipses and rectangles.
|
||||
* Support spaces in the controller name of VirtualBox clones.
|
||||
* Ignore Unicode errors when executing vboxmanage.
|
||||
* Get Windows interface list from the registry if the COM service fails.
|
||||
|
||||
## 1.2.1 2014/12/04
|
||||
|
||||
* Support for full screen mode (View -> Fullscreen).
|
||||
* Bundled Qemu 0.13.0 in the Windows all-in-one. Default for all local Qemu VMs.
|
||||
* Bundled Qemu 0.14.1 in the Mac OS X App. Default for all local Qemu VMs.
|
||||
* Changed ASA defaults to use Qemu 0.13.0 (on Windows), have 4 interfaces and CPU throttling to 65%.
|
||||
* Fixed SecureCRT command line when space in the device name.
|
||||
* Fixed port sorting issues.
|
||||
* Added default path for VBoxManage on Mac OS X
|
||||
* Upgraded gns3-converter to version 1.1.1 for Windows all-in-one and Mac OS X DMG.
|
||||
* New idle-PC field validation.
|
||||
* Possibility to load the project from command line (or double-click on a project on Windows).
|
||||
* Fixed Unicode error when using VirtualBox VM with a name containing non-english characters.
|
||||
|
||||
## 1.2 2014/11/20
|
||||
|
||||
* New GUI styles: charcoal (default) & classic. Changing GUI Preferences
|
||||
* Integration of GNS3 converter (allows old .net topologies to be opened).
|
||||
* Allow Qemu VM to have no interface.
|
||||
* Automatically extract IOS configs when a project is closed.
|
||||
* Show the cancel button in Wizards on Mac OS X.
|
||||
* Fix crash on Windows 32-bit.
|
||||
* Fix "new project" bug when using the GNS3 IOU VM.
|
||||
* Fix "could not find unused port" WinError 10013 bug
|
||||
* qemu-system-i386 is the new default on 32-bit platforms.
|
||||
* Option to deactivate the new project dialog at startup.
|
||||
* Add "open a project" and "recent projects" buttons to the new project dialog.
|
||||
* Fix platform detection issue with some Cisco IOS image file name.
|
||||
* Add delay (default 500 ms) when Console to all nodes.
|
||||
* Check for duplicate node names in Preferences.
|
||||
* Fix bug when editing a Qemu VM configured to run on a remote server.
|
||||
* News dock widget is smaller.
|
||||
* Fix SecureCRT issue when disconnecting from an IOU device on Windows.
|
||||
* Update VPCS to version 0.6 in the all-in-one installer.
|
||||
|
||||
## 1.1 2014/11/20
|
||||
|
||||
* Fixed broken cloud.
|
||||
* Fixed broken remote server.
|
||||
* Fixed Qemu binaries not showing up when editing a Qemu VM.
|
||||
* Fixed EtherSwitch (until we come with a default template for it).
|
||||
* Serial console for local VirtualBox.
|
||||
* Warning message when creating an IOU device with a remote server in the Wizard.
|
||||
* New Idle-PC dialog.
|
||||
@@ -4,8 +4,8 @@ include INSTALL
|
||||
include LICENSE
|
||||
include MANIFEST.in
|
||||
include tox.ini
|
||||
recursive-exclude tests *
|
||||
recursive-include docs *
|
||||
recursive-include tests *
|
||||
recursive-include gns3 *
|
||||
recursive-include resources *
|
||||
recursive-exclude * __pycache__
|
||||
recursive-exclude * *.py[co]
|
||||
|
||||
64
README.rst
64
README.rst
@@ -1,7 +1,14 @@
|
||||
GNS3-gui
|
||||
========
|
||||
|
||||
GNS3 GUI repository (beta stage).
|
||||
.. image:: https://travis-ci.org/GNS3/gns3-gui.svg?branch=master
|
||||
:target: https://travis-ci.org/GNS3/gns3-gui
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/gns3-gui.svg
|
||||
:target: https://pypi.python.org/pypi/gns3-gui
|
||||
|
||||
|
||||
GNS3 GUI repository.
|
||||
|
||||
Linux (Debian based)
|
||||
--------------------
|
||||
@@ -13,7 +20,7 @@ Dependencies:
|
||||
|
||||
- Python 3.3 or above
|
||||
- Setuptools
|
||||
- PyQt libraries
|
||||
- PyQt 5 libraries
|
||||
- Apache Libcloud library
|
||||
- Requests library
|
||||
- Paramiko library
|
||||
@@ -23,6 +30,13 @@ The following commands will install some of these dependencies:
|
||||
.. code:: bash
|
||||
|
||||
sudo apt-get install python3-setuptools
|
||||
sudo apt-get install python3-pyqt5
|
||||
sudo apt-get install python3-pyqt5.qtsvg
|
||||
sudo apt-get install python3-pyqt5.qtwebkit
|
||||
|
||||
If you want to test using PyQt4
|
||||
|
||||
.. code:: bash
|
||||
sudo apt-get install python3-pyqt4
|
||||
|
||||
Finally these commands will install the GUI as well as the rest of the dependencies:
|
||||
@@ -36,7 +50,23 @@ Finally these commands will install the GUI as well as the rest of the dependenc
|
||||
Windows
|
||||
-------
|
||||
|
||||
Please use our all-in-one installer.
|
||||
Please use our `all-in-one installer <https://community.gns3.com/community/software/download>`_ to install the stable build.
|
||||
|
||||
If you install via source you need to first install:
|
||||
|
||||
- Python (3.3 or above) - https://www.python.org/downloads/windows/
|
||||
- Pywin32 - https://sourceforge.net/projects/pywin32/
|
||||
- Qt5 - http://www.qt.io/download-open-source/
|
||||
- PyQt5 - http://www.riverbankcomputing.com/software/pyqt/download5
|
||||
- PyCrypto (which if you compile from source, requires Visual Studio 2010 with GMP or MPIR libraries)
|
||||
|
||||
And finally, call
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python setup.py install
|
||||
|
||||
to install the remaining dependencies.
|
||||
|
||||
Mac OS X
|
||||
--------
|
||||
@@ -52,6 +82,11 @@ Then install the GNS3 dependencies.
|
||||
brew install python3
|
||||
brew install qt
|
||||
brew install sip --without-python --with-python3
|
||||
brew install pyqt5 --without-python --with-python3
|
||||
|
||||
If you want to test using PyQt4
|
||||
|
||||
.. code:: bash
|
||||
brew install pyqt --without-python --with-python3
|
||||
|
||||
Finally, install both the GUI & server from the source.
|
||||
@@ -67,3 +102,26 @@ Finally, install both the GUI & server from the source.
|
||||
python3 setup.py install
|
||||
|
||||
Or follow this `HOWTO that uses MacPorts <http://binarynature.blogspot.ca/2014/05/install-gns3-early-release-on-mac-os-x.html>`_.
|
||||
|
||||
Developement
|
||||
-------------
|
||||
|
||||
If you want to update the interface, modify the .ui files using QT tools. And:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
cd scripts
|
||||
python build_pyqt.py
|
||||
|
||||
|
||||
Test with PyQT4
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
If you want to simulate a user with PyQT4:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
export GNS3_QT4=1
|
||||
python gns3/main.py
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
-rrequirements.txt
|
||||
|
||||
pep8
|
||||
pytest
|
||||
pytest-pythonpath # useful for running tests outside tox
|
||||
pytest-timeout
|
||||
pytest-capturelog
|
||||
|
||||
38
fake_frozen_gns3.py
Executable file
38
fake_frozen_gns3.py
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
This script fake GNS3 run as a frozen app.
|
||||
|
||||
Use it for testing stuff like self update.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import importlib
|
||||
|
||||
# Fake GNS3 run from a binary
|
||||
sys.executable = os.path.realpath(__file__)
|
||||
|
||||
# Add site-package directory before cx_freeze directory
|
||||
sys.path.insert(0, os.path.dirname(sys.executable))
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(sys.executable), 'site-packages'))
|
||||
|
||||
sys.frozen = True
|
||||
|
||||
module = importlib.import_module("gns3.main")
|
||||
module.main()
|
||||
@@ -1,341 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Base cloud controller class.
|
||||
|
||||
Base class for interacting with Cloud APIs to create and manage cloud
|
||||
instances.
|
||||
|
||||
"""
|
||||
from collections import namedtuple
|
||||
import hashlib
|
||||
import os
|
||||
import logging
|
||||
from io import StringIO, BytesIO
|
||||
|
||||
from libcloud.compute.base import NodeAuthSSHKey
|
||||
from libcloud.storage.types import ContainerAlreadyExistsError, ContainerDoesNotExistError, ObjectDoesNotExistError
|
||||
|
||||
from .exceptions import ItemNotFound, KeyPairExists, MethodNotAllowed
|
||||
from .exceptions import OverLimit, BadRequest, ServiceUnavailable
|
||||
from .exceptions import Unauthorized, ApiError
|
||||
|
||||
|
||||
KeyPair = namedtuple("KeyPair", ['name'], verbose=False)
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def parse_exception(exception):
|
||||
"""
|
||||
Parse the exception to separate the HTTP status code from the text.
|
||||
|
||||
Libcloud raises many exceptions of the form:
|
||||
Exception("<http status code> <http error> <reponse body>")
|
||||
|
||||
in lieu of raising specific incident-based exceptions.
|
||||
|
||||
"""
|
||||
|
||||
e_str = str(exception)
|
||||
|
||||
try:
|
||||
status = int(e_str[0:3])
|
||||
error_text = e_str[3:]
|
||||
|
||||
except ValueError:
|
||||
status = None
|
||||
error_text = e_str
|
||||
|
||||
return status, error_text
|
||||
|
||||
|
||||
class BaseCloudCtrl(object):
|
||||
|
||||
""" Base class for interacting with a cloud provider API. """
|
||||
|
||||
http_status_to_exception = {
|
||||
400: BadRequest,
|
||||
401: Unauthorized,
|
||||
404: ItemNotFound,
|
||||
405: MethodNotAllowed,
|
||||
413: OverLimit,
|
||||
500: ApiError,
|
||||
503: ServiceUnavailable
|
||||
}
|
||||
|
||||
GNS3_CONTAINER_NAME = 'GNS3'
|
||||
|
||||
def __init__(self, username, api_key):
|
||||
self.username = username
|
||||
self.api_key = api_key
|
||||
|
||||
def _handle_exception(self, status, error_text, response_overrides=None):
|
||||
""" Raise an exception based on the HTTP status. """
|
||||
|
||||
if response_overrides:
|
||||
if status in response_overrides:
|
||||
raise response_overrides[status](error_text)
|
||||
|
||||
raise self.http_status_to_exception[status](error_text)
|
||||
|
||||
def authenticate(self):
|
||||
""" Validate cloud account credentials. Return boolean. """
|
||||
raise NotImplementedError
|
||||
|
||||
def list_sizes(self):
|
||||
""" Return a list of NodeSize objects. """
|
||||
|
||||
return self.driver.list_sizes()
|
||||
|
||||
def list_flavors(self):
|
||||
""" Return an iterable of flavors """
|
||||
|
||||
raise NotImplementedError
|
||||
|
||||
def create_instance(self, name, size_id, image_id, keypair):
|
||||
"""
|
||||
Create a new instance with the supplied attributes.
|
||||
|
||||
Return a Node object.
|
||||
|
||||
"""
|
||||
try:
|
||||
image = self.get_image(image_id)
|
||||
if image is None:
|
||||
raise ItemNotFound("Image not found")
|
||||
|
||||
size = self.driver.ex_get_size(size_id)
|
||||
|
||||
args = {
|
||||
"name": name,
|
||||
"size": size,
|
||||
"image": image,
|
||||
}
|
||||
|
||||
if keypair is not None:
|
||||
auth_key = NodeAuthSSHKey(keypair.public_key)
|
||||
args["auth"] = auth_key
|
||||
args["ex_keyname"] = name
|
||||
|
||||
return self.driver.create_node(**args)
|
||||
|
||||
except Exception as e:
|
||||
status, error_text = parse_exception(e)
|
||||
|
||||
if status:
|
||||
self._handle_exception(status, error_text)
|
||||
else:
|
||||
log.error("create_instance method raised an exception: {}".format(e))
|
||||
log.error('image id {}'.format(image))
|
||||
|
||||
def delete_instance(self, instance):
|
||||
""" Delete the specified instance. Returns True or False. """
|
||||
|
||||
try:
|
||||
return self.driver.destroy_node(instance)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
status, error_text = parse_exception(e)
|
||||
|
||||
if status:
|
||||
self._handle_exception(status, error_text)
|
||||
else:
|
||||
raise e
|
||||
|
||||
def get_instance(self, instance):
|
||||
""" Return a Node object representing the requested instance. """
|
||||
|
||||
for i in self.driver.list_nodes():
|
||||
if i.id == instance.id:
|
||||
return i
|
||||
|
||||
raise ItemNotFound("Instance not found")
|
||||
|
||||
def list_instances(self):
|
||||
""" Return a list of instances in the current region. """
|
||||
|
||||
try:
|
||||
return self.driver.list_nodes()
|
||||
except Exception as e:
|
||||
log.error("list_instances returned an error: {}".format(e))
|
||||
|
||||
|
||||
def create_key_pair(self, name):
|
||||
""" Create and return a new Key Pair. """
|
||||
|
||||
response_overrides = {
|
||||
409: KeyPairExists
|
||||
}
|
||||
try:
|
||||
return self.driver.create_key_pair(name)
|
||||
|
||||
except Exception as e:
|
||||
status, error_text = parse_exception(e)
|
||||
if status:
|
||||
self._handle_exception(status, error_text, response_overrides)
|
||||
else:
|
||||
raise e
|
||||
|
||||
def delete_key_pair(self, keypair):
|
||||
""" Delete the keypair. Returns True or False. """
|
||||
|
||||
try:
|
||||
return self.driver.delete_key_pair(keypair)
|
||||
|
||||
except Exception as e:
|
||||
status, error_text = parse_exception(e)
|
||||
if status:
|
||||
self._handle_exception(status, error_text)
|
||||
else:
|
||||
raise e
|
||||
|
||||
def delete_key_pair_by_name(self, keypair_name):
|
||||
""" Utility method to incapsulate boilerplate code """
|
||||
|
||||
kp = KeyPair(name=keypair_name)
|
||||
return self.delete_key_pair(kp)
|
||||
|
||||
def list_key_pairs(self):
|
||||
""" Return a list of Key Pairs. """
|
||||
|
||||
return self.driver.list_key_pairs()
|
||||
|
||||
def upload_file(self, file_path, cloud_object_name):
|
||||
"""
|
||||
Uploads file to cloud storage (if it is not identical to a file already in cloud storage).
|
||||
:param file_path: path to file to upload
|
||||
:param cloud_object_name: name of file saved in cloud storage
|
||||
:return: True if file was uploaded, False if it was skipped because it already existed and was identical
|
||||
"""
|
||||
try:
|
||||
gns3_container = self.storage_driver.create_container(self.GNS3_CONTAINER_NAME)
|
||||
except ContainerAlreadyExistsError:
|
||||
gns3_container = self.storage_driver.get_container(self.GNS3_CONTAINER_NAME)
|
||||
|
||||
with open(file_path, 'rb') as file:
|
||||
local_file_hash = hashlib.md5(file.read()).hexdigest()
|
||||
|
||||
cloud_hash_name = cloud_object_name + '.md5'
|
||||
cloud_objects = [obj.name for obj in gns3_container.list_objects()]
|
||||
|
||||
# if the file and its hash are in object storage, and the local and storage file hashes match
|
||||
# do not upload the file, otherwise upload it
|
||||
if cloud_object_name in cloud_objects and cloud_hash_name in cloud_objects:
|
||||
hash_object = gns3_container.get_object(cloud_hash_name)
|
||||
cloud_object_hash = ''
|
||||
for chunk in hash_object.as_stream():
|
||||
cloud_object_hash += chunk.decode('utf8')
|
||||
|
||||
if cloud_object_hash == local_file_hash:
|
||||
return False
|
||||
|
||||
file.seek(0)
|
||||
self.storage_driver.upload_object_via_stream(file, gns3_container, cloud_object_name)
|
||||
self.storage_driver.upload_object_via_stream(StringIO(local_file_hash), gns3_container, cloud_hash_name)
|
||||
return True
|
||||
|
||||
def list_projects(self):
|
||||
"""
|
||||
Lists projects in cloud storage
|
||||
:return: Dictionary where project names are keys and values are names of objects in storage
|
||||
"""
|
||||
|
||||
try:
|
||||
gns3_container = self.storage_driver.get_container(self.GNS3_CONTAINER_NAME)
|
||||
projects = {
|
||||
obj.name.replace('projects/', '').replace('.zip', ''): obj.name
|
||||
for obj in gns3_container.list_objects()
|
||||
if obj.name.startswith('projects/') and obj.name[-4:] == '.zip'
|
||||
}
|
||||
return projects
|
||||
except ContainerDoesNotExistError:
|
||||
return []
|
||||
|
||||
def download_file(self, file_name, destination=None):
|
||||
"""
|
||||
Downloads file from cloud storage. If a file exists at destination, and it is identical to the file in cloud
|
||||
storage, it is not downloaded.
|
||||
:param file_name: name of file in cloud storage to download
|
||||
:param destination: local path to save file to (if None, returns file contents as a file-like object)
|
||||
:return: A file-like object if file contents are returned, or None if file is saved to filesystem
|
||||
"""
|
||||
|
||||
gns3_container = self.storage_driver.get_container(self.GNS3_CONTAINER_NAME)
|
||||
storage_object = gns3_container.get_object(file_name)
|
||||
|
||||
if destination is not None:
|
||||
if os.path.isfile(destination):
|
||||
# if a file exists at destination and its hash matches that of the
|
||||
# file in cloud storage, don't download it
|
||||
with open(destination, 'rb') as f:
|
||||
local_file_hash = hashlib.md5(f.read()).hexdigest()
|
||||
|
||||
hash_object = gns3_container.get_object(file_name + '.md5')
|
||||
cloud_object_hash = ''
|
||||
for chunk in hash_object.as_stream():
|
||||
cloud_object_hash += chunk.decode('utf8')
|
||||
|
||||
if local_file_hash == cloud_object_hash:
|
||||
return
|
||||
|
||||
storage_object.download(destination)
|
||||
else:
|
||||
contents = b''
|
||||
|
||||
for chunk in storage_object.as_stream():
|
||||
contents += chunk
|
||||
|
||||
return BytesIO(contents)
|
||||
|
||||
def find_storage_image_names(self, images_to_find):
|
||||
"""
|
||||
Maps names of image files to their full name in cloud storage
|
||||
:param images_to_find: list of image names to find
|
||||
:return: A dictionary where keys are image names, and values are the corresponding names of
|
||||
the files in cloud storage
|
||||
"""
|
||||
gns3_container = self.storage_driver.get_container(self.GNS3_CONTAINER_NAME)
|
||||
images_in_storage = [obj.name for obj in gns3_container.list_objects() if obj.name.startswith('images/')]
|
||||
|
||||
images = {}
|
||||
for image_name in images_to_find:
|
||||
images_with_same_name =\
|
||||
list(filter(lambda storage_image_name: storage_image_name.endswith(image_name), images_in_storage))
|
||||
|
||||
if len(images_with_same_name) == 1:
|
||||
images[image_name] = images_with_same_name[0]
|
||||
else:
|
||||
raise Exception('Image does not exist in cloud storage or is duplicated')
|
||||
|
||||
return images
|
||||
|
||||
def delete_file(self, file_name):
|
||||
gns3_container = self.storage_driver.get_container(self.GNS3_CONTAINER_NAME)
|
||||
|
||||
try:
|
||||
object_to_delete = gns3_container.get_object(file_name)
|
||||
object_to_delete.delete()
|
||||
except ObjectDoesNotExistError:
|
||||
pass
|
||||
|
||||
try:
|
||||
hash_object = gns3_container.get_object(file_name + '.md5')
|
||||
hash_object.delete()
|
||||
except ObjectDoesNotExistError:
|
||||
pass
|
||||
@@ -1,45 +0,0 @@
|
||||
""" Exception classes for CloudCtrl classes. """
|
||||
|
||||
class ApiError(Exception):
|
||||
""" Raised when the server returns 500 Compute Error. """
|
||||
pass
|
||||
|
||||
class BadRequest(Exception):
|
||||
""" Raised when the server returns 400 Bad Request. """
|
||||
pass
|
||||
|
||||
class ComputeFault(Exception):
|
||||
""" Raised when the server returns 400|500 Compute Fault. """
|
||||
pass
|
||||
|
||||
class Forbidden(Exception):
|
||||
""" Raised when the server returns 403 Forbidden. """
|
||||
pass
|
||||
|
||||
class ItemNotFound(Exception):
|
||||
""" Raised when the server returns 404 Not Found. """
|
||||
pass
|
||||
|
||||
class KeyPairExists(Exception):
|
||||
""" Raised when the server returns 409 Conflict Key pair exists. """
|
||||
pass
|
||||
|
||||
class MethodNotAllowed(Exception):
|
||||
""" Raised when the server returns 405 Method Not Allowed. """
|
||||
pass
|
||||
|
||||
class OverLimit(Exception):
|
||||
""" Raised when the server returns 413 Over Limit. """
|
||||
pass
|
||||
|
||||
class ServerCapacityUnavailable(Exception):
|
||||
""" Raised when the server returns 503 Server Capacity Uavailable. """
|
||||
pass
|
||||
|
||||
class ServiceUnavailable(Exception):
|
||||
""" Raised when the server returns 503 Service Unavailable. """
|
||||
pass
|
||||
|
||||
class Unauthorized(Exception):
|
||||
""" Raised when the server returns 401 Unauthorized. """
|
||||
pass
|
||||
@@ -1,311 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
""" Interacts with Rackspace API to create and manage cloud instances. """
|
||||
|
||||
from .base_cloud_ctrl import BaseCloudCtrl
|
||||
import json
|
||||
import requests
|
||||
from libcloud.compute.drivers.rackspace import ENDPOINT_ARGS_MAP
|
||||
from libcloud.compute.providers import get_driver
|
||||
from libcloud.compute.types import Provider
|
||||
from libcloud.storage.providers import get_driver as get_storage_driver
|
||||
from libcloud.storage.types import Provider as StorageProvider
|
||||
|
||||
from .exceptions import ItemNotFound, ApiError
|
||||
from ..version import __version__
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
RACKSPACE_REGIONS = [{ENDPOINT_ARGS_MAP[k]['region']: k} for k in
|
||||
ENDPOINT_ARGS_MAP]
|
||||
|
||||
|
||||
class RackspaceCtrl(BaseCloudCtrl):
|
||||
|
||||
""" Controller class for interacting with Rackspace API. """
|
||||
|
||||
def __init__(self, username, api_key, gns3_ias_url):
|
||||
super(RackspaceCtrl, self).__init__(username, api_key)
|
||||
|
||||
self.gns3_ias_url = gns3_ias_url
|
||||
|
||||
# set this up so it can be swapped out with a mock for testing
|
||||
self.post_fn = requests.post
|
||||
self.driver_cls = get_driver(Provider.RACKSPACE)
|
||||
self.storage_driver_cls = get_storage_driver(StorageProvider.CLOUDFILES)
|
||||
|
||||
self.driver = None
|
||||
self.storage_driver = None
|
||||
self.region = None
|
||||
self.instances = {}
|
||||
|
||||
self.authenticated = False
|
||||
self.identity_ep = \
|
||||
"https://identity.api.rackspacecloud.com/v2.0/tokens"
|
||||
|
||||
self.regions = []
|
||||
self.token = None
|
||||
self.tenant_id = None
|
||||
self.flavor_ep = "https://dfw.servers.api.rackspacecloud.com/v2/{username}/flavors"
|
||||
self._flavors = OrderedDict([
|
||||
('2', '512MB, 1 VCPU'),
|
||||
('3', '1GB, 1 VCPU'),
|
||||
('4', '2GB, 2 VCPUs'),
|
||||
('5', '4GB, 2 VCPUs'),
|
||||
('6', '8GB, 4 VCPUs'),
|
||||
('7', '15GB, 6 VCPUs'),
|
||||
('8', '30GB, 8 VCPUs'),
|
||||
('performance1-1', '1GB Performance, 1 VCPU'),
|
||||
('performance1-2', '2GB Performance, 2 VCPUs'),
|
||||
('performance1-4', '4GB Performance, 4 VCPUs'),
|
||||
('performance1-8', '8GB Performance, 8 VCPUs'),
|
||||
('performance2-15', '15GB Performance, 4 VCPUs'),
|
||||
('performance2-30', '30GB Performance, 8 VCPUs'),
|
||||
('performance2-60', '60GB Performance, 16 VCPUs'),
|
||||
('performance2-90', '90GB Performance, 24 VCPUs'),
|
||||
('performance2-120', '120GB Performance, 32 VCPUs',)
|
||||
])
|
||||
|
||||
def authenticate(self):
|
||||
"""
|
||||
Submit username and api key to API service.
|
||||
|
||||
If authentication is successful, set self.regions and self.token.
|
||||
Return boolean.
|
||||
|
||||
"""
|
||||
|
||||
self.authenticated = False
|
||||
|
||||
if len(self.username) < 1:
|
||||
return False
|
||||
|
||||
if len(self.api_key) < 1:
|
||||
return False
|
||||
|
||||
data = json.dumps({
|
||||
"auth": {
|
||||
"RAX-KSKEY:apiKeyCredentials": {
|
||||
"username": self.username,
|
||||
"apiKey": self.api_key
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
headers = {
|
||||
'Content-type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
|
||||
response = self.post_fn(self.identity_ep, data=data, headers=headers)
|
||||
|
||||
if response.status_code == 200:
|
||||
|
||||
api_data = response.json()
|
||||
self.token = self._parse_token(api_data)
|
||||
|
||||
if self.token:
|
||||
self.authenticated = True
|
||||
user_regions = self._parse_endpoints(api_data)
|
||||
self.regions = self._make_region_list(user_regions)
|
||||
self.tenant_id = self._parse_tenant_id(api_data)
|
||||
|
||||
else:
|
||||
self.regions = []
|
||||
self.token = None
|
||||
|
||||
response.connection.close()
|
||||
|
||||
return self.authenticated
|
||||
|
||||
def list_regions(self):
|
||||
""" Return a list the regions available to the user. """
|
||||
|
||||
return self.regions
|
||||
|
||||
def list_flavors(self):
|
||||
""" Return the dictionary containing flavors id and names """
|
||||
|
||||
return self._flavors
|
||||
|
||||
def _parse_endpoints(self, api_data):
|
||||
"""
|
||||
Parse the JSON-encoded data returned by the Identity Service API.
|
||||
|
||||
Return a list of regions available for Compute v2.
|
||||
|
||||
"""
|
||||
|
||||
region_codes = []
|
||||
|
||||
for ep_type in api_data['access']['serviceCatalog']:
|
||||
if ep_type['name'] == "cloudServersOpenStack" \
|
||||
and ep_type['type'] == "compute":
|
||||
|
||||
for ep in ep_type['endpoints']:
|
||||
if ep['versionId'] == "2":
|
||||
region_codes.append(ep['region'])
|
||||
|
||||
return region_codes
|
||||
|
||||
def _parse_token(self, api_data):
|
||||
""" Parse the token from the JSON-encoded data returned by the API. """
|
||||
|
||||
try:
|
||||
token = api_data['access']['token']['id']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
return token
|
||||
|
||||
def _parse_tenant_id(self, api_data):
|
||||
""" """
|
||||
try:
|
||||
roles = api_data['access']['user']['roles']
|
||||
for role in roles:
|
||||
if 'tenantId' in role and role['name'] == 'compute:default':
|
||||
return role['tenantId']
|
||||
return None
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def _make_region_list(self, region_codes):
|
||||
"""
|
||||
Make a list of regions for use in the GUI.
|
||||
|
||||
Returns a list of key-value pairs in the form:
|
||||
<API's Region Name>: <libcloud's Region Name>
|
||||
eg,
|
||||
[
|
||||
{'DFW': 'dfw'}
|
||||
{'ORD': 'ord'},
|
||||
...
|
||||
]
|
||||
|
||||
"""
|
||||
|
||||
region_list = []
|
||||
|
||||
for ep in ENDPOINT_ARGS_MAP:
|
||||
if ENDPOINT_ARGS_MAP[ep]['region'] in region_codes:
|
||||
region_list.append({ENDPOINT_ARGS_MAP[ep]['region']: ep})
|
||||
|
||||
return region_list
|
||||
|
||||
def set_region(self, region):
|
||||
""" Set self.region and self.driver. Returns True or False. """
|
||||
|
||||
try:
|
||||
self.driver = self.driver_cls(self.username, self.api_key,
|
||||
region=region)
|
||||
self.storage_driver = self.storage_driver_cls(self.username, self.api_key,
|
||||
region=region)
|
||||
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
self.region = region
|
||||
return True
|
||||
|
||||
def _get_shared_images(self, username, region, gns3_version):
|
||||
"""
|
||||
Given a GNS3 version, ask gns3-ias to share compatible images
|
||||
|
||||
Response:
|
||||
[{"created_at": "", "schema": "", "status": "", "member_id": "", "image_id": "", "updated_at": ""},]
|
||||
or, if access was already asked
|
||||
[{"image_id": "", "member_id": "", "status": "ALREADYREQUESTED"},]
|
||||
"""
|
||||
endpoint = self.gns3_ias_url+"/images/grant_access"
|
||||
params = {
|
||||
"user_id": username,
|
||||
"user_region": region.upper(),
|
||||
"gns3_version": gns3_version,
|
||||
}
|
||||
try:
|
||||
response = requests.get(endpoint, params=params)
|
||||
except requests.ConnectionError:
|
||||
raise ApiError("Unable to connect to IAS")
|
||||
|
||||
status = response.status_code
|
||||
|
||||
if status == 200:
|
||||
return response.json()
|
||||
elif status == 404:
|
||||
raise ItemNotFound()
|
||||
else:
|
||||
raise ApiError("IAS status code: %d" % status)
|
||||
|
||||
def list_images(self):
|
||||
"""
|
||||
Return a dictionary containing RackSpace server images
|
||||
retrieved from gns3-ias server
|
||||
"""
|
||||
if not (self.tenant_id and self.region):
|
||||
return {}
|
||||
|
||||
try:
|
||||
shared_images = self._get_shared_images(self.tenant_id, self.region, __version__)
|
||||
images = {}
|
||||
for i in shared_images:
|
||||
images[i['image_id']] = i['image_name']
|
||||
return images
|
||||
except ItemNotFound:
|
||||
return {}
|
||||
except ApiError as e:
|
||||
log.error('Error while retrieving image list: %s' % e)
|
||||
return {}
|
||||
|
||||
def get_image(self, image_id):
|
||||
return self.driver.get_image(image_id)
|
||||
|
||||
|
||||
def get_provider(cloud_settings):
|
||||
"""
|
||||
Utility function to retrieve a cloud provider instance already authenticated and with the
|
||||
region set
|
||||
|
||||
:param cloud_settings: cloud settings dictionary
|
||||
:return: a provider instance or None on errors
|
||||
"""
|
||||
try:
|
||||
username = cloud_settings['cloud_user_name']
|
||||
apikey = cloud_settings['cloud_api_key']
|
||||
region = cloud_settings['cloud_region']
|
||||
ias_url = cloud_settings['gns3_ias_url']
|
||||
except KeyError as e:
|
||||
log.error("Unable to create cloud provider: {}".format(e))
|
||||
return
|
||||
|
||||
provider = RackspaceCtrl(username, apikey, ias_url)
|
||||
|
||||
if not provider.authenticate():
|
||||
log.error("Authentication failed for cloud provider")
|
||||
return
|
||||
|
||||
if not region:
|
||||
region = provider.list_regions().values()[0]
|
||||
|
||||
if not provider.set_region(region):
|
||||
log.error("Unable to set cloud provider region")
|
||||
return
|
||||
|
||||
return provider
|
||||
@@ -1,466 +0,0 @@
|
||||
from contextlib import contextmanager
|
||||
import io
|
||||
import json
|
||||
from socket import error as socket_error
|
||||
import logging
|
||||
import os
|
||||
import select
|
||||
import tempfile
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
from PyQt4.QtCore import QThread
|
||||
from PyQt4.QtCore import pyqtSignal
|
||||
|
||||
from .exceptions import KeyPairExists
|
||||
from .rackspace_ctrl import RackspaceCtrl, get_provider
|
||||
from ..topology import Topology
|
||||
from ..servers import Servers
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def ssh_client(host, key_string):
|
||||
"""
|
||||
Context manager wrapping a SSHClient instance: the client connects on
|
||||
enter and close the connection on exit
|
||||
"""
|
||||
|
||||
import paramiko
|
||||
class AllowAndForgetPolicy(paramiko.MissingHostKeyPolicy):
|
||||
"""
|
||||
Custom policy for server host keys: we simply accept the key
|
||||
the server sent to us without storing it.
|
||||
"""
|
||||
def missing_host_key(self, *args, **kwargs):
|
||||
"""
|
||||
According to MissingHostKeyPolicy protocol, to accept
|
||||
the key, simply return.
|
||||
"""
|
||||
return
|
||||
|
||||
client = paramiko.SSHClient()
|
||||
try:
|
||||
f_key = io.StringIO(key_string)
|
||||
key = paramiko.RSAKey.from_private_key(f_key)
|
||||
client.set_missing_host_key_policy(AllowAndForgetPolicy())
|
||||
client.connect(hostname=host, username="root", pkey=key)
|
||||
yield client
|
||||
except socket_error as e:
|
||||
log.error("SSH connection error to {}: {}".format(host, e))
|
||||
yield None
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
|
||||
class ListInstancesThread(QThread):
|
||||
"""
|
||||
Helper class to retrieve data from the provider in a separate thread,
|
||||
avoid freezing the gui
|
||||
"""
|
||||
instancesReady = pyqtSignal(object)
|
||||
|
||||
def __init__(self, parent, provider):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._provider = provider
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
instances = self._provider.list_instances()
|
||||
log.debug('Instance list: {}'.format([(i.name, i.state) for i in instances]))
|
||||
self.instancesReady.emit(instances)
|
||||
except Exception as e:
|
||||
log.info('list_instances error: {}'.format(e))
|
||||
|
||||
|
||||
class CreateInstanceThread(QThread):
|
||||
"""
|
||||
Helper class to create instances in a separate thread
|
||||
"""
|
||||
instanceCreated = pyqtSignal(object, object)
|
||||
|
||||
def __init__(self, parent, provider, name, flavor_id, image_id):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._provider = provider
|
||||
self._name = name
|
||||
self._flavor_id = flavor_id
|
||||
self._image_id = image_id
|
||||
|
||||
def run(self):
|
||||
log.debug("Creating cloud keypair with name {}".format(self._name))
|
||||
try:
|
||||
k = self._provider.create_key_pair(self._name)
|
||||
except KeyPairExists:
|
||||
log.debug("Cloud keypair with name {} exists. Recreating.".format(self._name))
|
||||
# delete keypairs if they already exist
|
||||
self._provider.delete_key_pair_by_name(self._name)
|
||||
k = self._provider.create_key_pair(self._name)
|
||||
|
||||
log.debug("Creating cloud server with name {}".format(self._name))
|
||||
i = self._provider.create_instance(self._name, self._flavor_id, self._image_id, k)
|
||||
log.debug("Cloud server {} created".format(self._name))
|
||||
|
||||
self.instanceCreated.emit(i, k)
|
||||
|
||||
|
||||
class DeleteInstanceThread(QThread):
|
||||
"""
|
||||
Helper class to remove an instance in a separate thread
|
||||
"""
|
||||
instanceDeleted = pyqtSignal(object)
|
||||
|
||||
def __init__(self, parent, provider, instance):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._provider = provider
|
||||
self._instance = instance
|
||||
|
||||
def run(self):
|
||||
if self._provider.delete_instance(self._instance):
|
||||
self.instanceDeleted.emit(self._instance)
|
||||
|
||||
|
||||
class StartGNS3ServerThread(QThread):
|
||||
"""
|
||||
Perform an SSH connection to the instances in a separate thread,
|
||||
outside the GUI event loop, and start GNS3 server
|
||||
"""
|
||||
gns3server_started = pyqtSignal(str, str, str)
|
||||
|
||||
# This is for testing without pushing to github
|
||||
# commands = '''
|
||||
# DEBIAN_FRONTEND=noninteractive dpkg --configure -a
|
||||
# DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386
|
||||
# DEBIAN_FRONTEND=noninteractive apt-get -y update
|
||||
# DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade
|
||||
# DEBIAN_FRONTEND=noninteractive apt-get -y install git python3-setuptools python3-netifaces python3-pip python3-zmq dynamips qemu-system
|
||||
# DEBIAN_FRONTEND=noninteractive apt-get -y install libc6:i386 libstdc++6:i386 libssl1.0.0:i386
|
||||
# ln -s /lib/i386-linux-gnu/libcrypto.so.1.0.0 /lib/i386-linux-gnu/libcrypto.so.4
|
||||
# mkdir -p /opt/gns3
|
||||
# tar xzf /tmp/gns3-server.tgz -C /opt/gns3
|
||||
# cd /opt/gns3/gns3-server; pip3 install -r dev-requirements.txt
|
||||
# cd /opt/gns3/gns3-server; python3 ./setup.py install
|
||||
# ln -sf /usr/bin/dynamips /usr/local/bin/dynamips
|
||||
# wget 'https://github.com/GNS3/iouyap/releases/download/0.95/iouyap.tar.gz'
|
||||
# python -c 'import struct; open("/etc/hostid", "w").write(struct.pack("i", 00000000))'
|
||||
# hostname gns3-iouvm
|
||||
# tar xzf iouyap.tar.gz -C /usr/local/bin
|
||||
# killall python3 gns3server gns3dms
|
||||
# '''
|
||||
|
||||
commands = '''
|
||||
DEBIAN_FRONTEND=noninteractive dpkg --configure -a
|
||||
DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install git python3-setuptools python3-netifaces python3-pip python3-zmq dynamips qemu-system
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install libc6:i386 libstdc++6:i386 libssl1.0.0:i386
|
||||
ln -s /lib/i386-linux-gnu/libcrypto.so.1.0.0 /lib/i386-linux-gnu/libcrypto.so.4
|
||||
mkdir -p /opt/gns3
|
||||
cd /opt/gns3; git clone https://github.com/planctechnologies/gns3-server.git
|
||||
cd /opt/gns3/gns3-server; git checkout dev; git pull
|
||||
cd /opt/gns3/gns3-server; pip3 install -r dev-requirements.txt
|
||||
cd /opt/gns3/gns3-server; python3 ./setup.py install
|
||||
ln -sf /usr/bin/dynamips /usr/local/bin/dynamips
|
||||
wget 'https://github.com/GNS3/iouyap/releases/download/0.95/iouyap.tar.gz'
|
||||
tar xzf iouyap.tar.gz -C /usr/local/bin
|
||||
python -c 'import struct; open("/etc/hostid", "w").write(struct.pack("i", 00000000))'
|
||||
hostname gns3-iouvm # set hostname for iou
|
||||
killall python3 gns3server gns3dms
|
||||
'''
|
||||
|
||||
def __init__(self, parent, host, private_key_string, server_id, username, api_key, region, dead_time):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._host = host
|
||||
self._private_key_string = private_key_string
|
||||
self._server_id = server_id
|
||||
self._username = username
|
||||
self._api_key = api_key
|
||||
self._region = region
|
||||
self._dead_time = dead_time
|
||||
|
||||
def exec_command(self, client, cmd, wait_time=-1):
|
||||
|
||||
cmd += '; exit $?'
|
||||
|
||||
stdout_data = b''
|
||||
stderr_data = b''
|
||||
|
||||
log.debug('cmd: {}'.format(cmd))
|
||||
# Send the command (non-blocking)
|
||||
stdin, stdout, stderr = client.exec_command(cmd)
|
||||
|
||||
# Wait for the command to terminate
|
||||
wait = int(wait_time)
|
||||
while not stdout.channel.exit_status_ready() and wait != 0:
|
||||
time.sleep(1)
|
||||
wait -= 1
|
||||
|
||||
stdout_data = stdout.read()
|
||||
stderr_data = stderr.read()
|
||||
log.debug('exit status: {}'.format(stdout.channel.exit_status))
|
||||
log.debug('stdout: {}'.format(stdout_data.decode('utf-8')))
|
||||
log.debug('stderr: {}'.format(stderr_data.decode('utf-8')))
|
||||
return stdout_data, stderr_data
|
||||
|
||||
|
||||
def run(self):
|
||||
# We might be attempting a connection before the instance is fully booted, so retry
|
||||
# when the ssh connection fails.
|
||||
ssh_connected = False
|
||||
while not ssh_connected:
|
||||
with ssh_client(self._host, self._private_key_string) as client:
|
||||
if client is None:
|
||||
time.sleep(1)
|
||||
continue
|
||||
ssh_connected = True
|
||||
|
||||
# This is for testing without pushing to github
|
||||
# os.system('rm -rf /tmp/gns3-server')
|
||||
# os.system('cp -a /Users/jseutter/projects/gns3-server /tmp/gns3-server')
|
||||
# os.system('cd /tmp; tar czf /tmp/gns3-server.tgz gns3-server')
|
||||
# sftp = client.open_sftp()
|
||||
# sftp.put('/tmp/gns3-server.tgz', '/tmp/gns3-server.tgz')
|
||||
# sftp.close()
|
||||
|
||||
for cmd in [l for l in self.commands.splitlines() if l.strip()]:
|
||||
self.exec_command(client, cmd)
|
||||
|
||||
data = {
|
||||
'instance_id': self._server_id,
|
||||
'cloud_user_name': self._username,
|
||||
'cloud_api_key': self._api_key,
|
||||
'cloud_region': self._region,
|
||||
'dead_time': self._dead_time,
|
||||
}
|
||||
# TODO: Properly escape the data portion of the command line
|
||||
start_cmd = '/usr/bin/python3 /opt/gns3/gns3-server/gns3server/start_server.py -d -v --ip={} --data="{}" 2>/tmp/gns3-stderr.log'.format(self._host, data)
|
||||
stdout, stderr = self.exec_command(client, start_cmd, wait_time=15)
|
||||
response = stdout.decode('utf-8')
|
||||
self.gns3server_started.emit(str(self._server_id), str(self._host), str(response))
|
||||
|
||||
|
||||
class WSConnectThread(QThread):
|
||||
"""
|
||||
Establish a websocket connection with the remote gns3server
|
||||
instance. Run outside the GUI event loop.
|
||||
"""
|
||||
established = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent, provider, server_id, host, port, ca_file,
|
||||
auth_user, auth_password, ssh_pkey, instance_id):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._provider = provider
|
||||
self._server_id = server_id
|
||||
self._host = host
|
||||
self._port = port
|
||||
self._ca_file = ca_file
|
||||
self._auth_user = auth_user
|
||||
self._auth_password = auth_password
|
||||
self._ssh_pkey = ssh_pkey
|
||||
self._instance_id = instance_id
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
Establish a websocket connection to gns3server on the cloud instance.
|
||||
"""
|
||||
|
||||
log.debug('WSConnectThread.run() begin')
|
||||
servers = Servers.instance()
|
||||
server = servers.getCloudServer(self._host, self._port, self._ca_file,
|
||||
self._auth_user, self._auth_password, self._ssh_pkey,
|
||||
self._instance_id)
|
||||
log.debug('after getCloudServer call. {}'.format(server))
|
||||
self.established.emit(str(self._server_id))
|
||||
|
||||
log.debug('WSConnectThread.run() end')
|
||||
# emit signal on success
|
||||
self.established.emit(self._server_id)
|
||||
|
||||
|
||||
class UploadProjectThread(QThread):
|
||||
"""
|
||||
Zip and Upload project to the cloud
|
||||
"""
|
||||
|
||||
# signals to update the progress dialog.
|
||||
error = pyqtSignal(str, bool)
|
||||
completed = pyqtSignal()
|
||||
update = pyqtSignal(int)
|
||||
|
||||
def __init__(self, cloud_settings, project_path, images_path):
|
||||
super().__init__()
|
||||
self.cloud_settings = cloud_settings
|
||||
self.project_path = project_path
|
||||
self.images_path = images_path
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
log.info("Exporting project to cloud")
|
||||
self.update.emit(0)
|
||||
|
||||
zipped_project_file = self.zip_project_dir()
|
||||
|
||||
self.update.emit(10) # update progress to 10%
|
||||
|
||||
provider = get_provider(self.cloud_settings)
|
||||
provider.upload_file(zipped_project_file, 'projects/' + os.path.basename(zipped_project_file))
|
||||
|
||||
self.update.emit(20) # update progress to 20%
|
||||
|
||||
topology = Topology.instance()
|
||||
images = set([node.settings()["image"] for node in topology.nodes() if 'image' in node.settings()])
|
||||
|
||||
for i, image in enumerate(images):
|
||||
provider.upload_file(image, 'images/' + os.path.relpath(image, self.images_path))
|
||||
self.update.emit(20 + (float(i) / len(images) * 80))
|
||||
|
||||
self.completed.emit()
|
||||
except Exception as e:
|
||||
log.exception("Error exporting project to cloud")
|
||||
self.error.emit("Error exporting project: {}".format(str(e)), True)
|
||||
|
||||
def zip_project_dir(self):
|
||||
"""
|
||||
Zips project files
|
||||
:return: path to zipped project file
|
||||
"""
|
||||
project_name = os.path.basename(self.project_path)
|
||||
output_filename = os.path.join(tempfile.gettempdir(), project_name + ".zip")
|
||||
project_dir = os.path.dirname(self.project_path)
|
||||
relroot = os.path.abspath(os.path.join(project_dir, os.pardir))
|
||||
with zipfile.ZipFile(output_filename, "w", zipfile.ZIP_DEFLATED) as zip_file:
|
||||
for root, dirs, files in os.walk(project_dir):
|
||||
# add directory (needed for empty dirs)
|
||||
zip_file.write(root, os.path.relpath(root, relroot))
|
||||
for file in files:
|
||||
filename = os.path.join(root, file)
|
||||
if os.path.isfile(filename) and not self._should_exclude(filename): # regular files only
|
||||
arcname = os.path.join(os.path.relpath(root, relroot), file)
|
||||
zip_file.write(filename, arcname)
|
||||
|
||||
return output_filename
|
||||
|
||||
def _should_exclude(self, filename):
|
||||
"""
|
||||
Returns True if file should be excluded from zip of project files
|
||||
:param filename:
|
||||
:return: True if file should be excluded from zip, False otherwise
|
||||
"""
|
||||
return filename.endswith('.ghost')
|
||||
|
||||
def stop(self):
|
||||
self.quit()
|
||||
|
||||
|
||||
class UploadFilesThread(QThread):
|
||||
"""
|
||||
Upload multiple files to cloud files
|
||||
|
||||
uploads - A list of 2-tuples of (local_src_path, remote_dst_path)
|
||||
"""
|
||||
|
||||
completed = pyqtSignal()
|
||||
|
||||
def __init__(self, parent, cloud_settings, uploads):
|
||||
super(QThread, self).__init__(parent)
|
||||
self._cloud_settings = cloud_settings
|
||||
self._uploads = uploads
|
||||
|
||||
def run(self):
|
||||
for src, dst in self._uploads:
|
||||
log.debug('Upload from {} to {}'.format(src, dst))
|
||||
provider = get_provider(self._cloud_settings)
|
||||
provider.upload_file(src, dst)
|
||||
log.debug('Upload image completed')
|
||||
self.completed.emit()
|
||||
|
||||
|
||||
class DownloadProjectThread(QThread):
|
||||
"""
|
||||
Downloads project from cloud storage
|
||||
"""
|
||||
|
||||
# signals to update the progress dialog.
|
||||
error = pyqtSignal(str, bool)
|
||||
completed = pyqtSignal()
|
||||
update = pyqtSignal(int)
|
||||
|
||||
def __init__(self, cloud_project_file_name, project_dest_path, images_dest_path, cloud_settings):
|
||||
super().__init__()
|
||||
self.project_name = cloud_project_file_name
|
||||
self.project_dest_path = project_dest_path
|
||||
self.images_dest_path = images_dest_path
|
||||
self.cloud_settings = cloud_settings
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.update.emit(0)
|
||||
provider = get_provider(self.cloud_settings)
|
||||
zip_file = provider.download_file(self.project_name)
|
||||
zip_file = zipfile.ZipFile(zip_file, mode='r')
|
||||
zip_file.extractall(self.project_dest_path)
|
||||
zip_file.close()
|
||||
project_name = zip_file.namelist()[0].strip('/')
|
||||
|
||||
self.update.emit(20)
|
||||
|
||||
with open(os.path.join(self.project_dest_path, project_name, project_name + '.gns3'), 'r') as f:
|
||||
project_settings = json.loads(f.read())
|
||||
|
||||
images = set()
|
||||
for node in project_settings["topology"].get("nodes", []):
|
||||
if "properties" in node and "image" in node["properties"]:
|
||||
images.add(node["properties"]["image"])
|
||||
|
||||
image_names_in_cloud = provider.find_storage_image_names(images)
|
||||
|
||||
for i, image in enumerate(images):
|
||||
dest_path = os.path.join(self.images_dest_path, *image_names_in_cloud[image].split('/')[1:])
|
||||
|
||||
if not os.path.exists(os.path.dirname(dest_path)):
|
||||
os.makedirs(os.path.dirname(dest_path))
|
||||
|
||||
provider.download_file(image_names_in_cloud[image], dest_path)
|
||||
self.update.emit(20 + (float(i) / len(images) * 80))
|
||||
|
||||
self.completed.emit()
|
||||
except Exception as e:
|
||||
log.exception("Error importing project from cloud")
|
||||
self.error.emit("Error importing project: {}".format(str(e)), True)
|
||||
|
||||
def stop(self):
|
||||
self.quit()
|
||||
|
||||
|
||||
class DeleteProjectThread(QThread):
|
||||
"""
|
||||
Deletes project from cloud storage
|
||||
"""
|
||||
|
||||
# signals to update the progress dialog.
|
||||
error = pyqtSignal(str, bool)
|
||||
completed = pyqtSignal()
|
||||
update = pyqtSignal(int)
|
||||
|
||||
def __init__(self, project_file_name, cloud_settings):
|
||||
super().__init__()
|
||||
self.project_file_name = project_file_name
|
||||
self.cloud_settings = cloud_settings
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
provider = get_provider(self.cloud_settings)
|
||||
provider.delete_file(self.project_file_name)
|
||||
self.completed.emit()
|
||||
except Exception as e:
|
||||
log.exception("Error deleting project")
|
||||
self.error.emit("Error deleting project: {}".format(str(e)), True)
|
||||
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_cloud_projects(cloud_settings):
|
||||
provider = get_provider(cloud_settings)
|
||||
return provider.list_projects()
|
||||
@@ -1,443 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import ast
|
||||
import logging
|
||||
import os
|
||||
from PyQt4.QtGui import QWidget
|
||||
from PyQt4.QtGui import QIcon
|
||||
from PyQt4.QtGui import QMenu
|
||||
from PyQt4.QtGui import QAction
|
||||
from PyQt4.QtGui import QInputDialog
|
||||
from PyQt4.QtCore import QAbstractTableModel
|
||||
from PyQt4.QtCore import QModelIndex
|
||||
from PyQt4.QtCore import QTimer
|
||||
from PyQt4.QtCore import pyqtSignal
|
||||
from PyQt4.Qt import Qt
|
||||
|
||||
from .cloud.utils import (ListInstancesThread, CreateInstanceThread, DeleteInstanceThread,
|
||||
StartGNS3ServerThread, WSConnectThread)
|
||||
from libcloud.compute.types import NodeState
|
||||
from .topology import Topology
|
||||
|
||||
# this widget was promoted on Creator, must use absolute imports
|
||||
from gns3.ui.cloud_inspector_view_ui import Ui_CloudInspectorView
|
||||
from gns3.cloud_instances import CloudInstances
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
POLLING_TIMER = 10000 # in milliseconds
|
||||
|
||||
|
||||
class RunningInstanceState(NodeState):
|
||||
"""
|
||||
GNS3 states for running instances
|
||||
"""
|
||||
GNS3SERVER_STARTING = 10
|
||||
GNS3SERVER_STARTED = 11
|
||||
WS_CONNECTED = 12
|
||||
|
||||
|
||||
class InstanceTableModel(QAbstractTableModel):
|
||||
"""
|
||||
A custom table model storing data of cloud instances
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InstanceTableModel, self).__init__(*args, **kwargs)
|
||||
self._header_data = ['Instance', '', 'Size', 'Devices'] # status has an empty header label
|
||||
self._width = len(self._header_data)
|
||||
self._instances = {}
|
||||
self._ids = []
|
||||
self.flavors = {}
|
||||
|
||||
@property
|
||||
def instanceIds(self):
|
||||
return self._ids
|
||||
|
||||
def clear(self):
|
||||
self._instances = {}
|
||||
self._ids = []
|
||||
self.reset()
|
||||
|
||||
def _get_status_icon_path(self, instance):
|
||||
"""
|
||||
Return a string pointing to the graphic resource
|
||||
"""
|
||||
if instance.state == RunningInstanceState.WS_CONNECTED:
|
||||
return ':/icons/led_green.svg'
|
||||
elif instance.state in (RunningInstanceState.STOPPED,
|
||||
RunningInstanceState.TERMINATED,
|
||||
RunningInstanceState.UNKNOWN):
|
||||
return ':/icons/led_red.svg'
|
||||
else:
|
||||
return ':/icons/led_yellow.svg'
|
||||
|
||||
def rowCount(self, QModelIndex_parent=None, *args, **kwargs):
|
||||
return len(self._instances)
|
||||
|
||||
def columnCount(self, QModelIndex_parent=None, *args, **kwargs):
|
||||
return self._width if len(self._instances) else 0
|
||||
|
||||
def data(self, index, role=None):
|
||||
instance = self._instances.get(self._ids[index.row()])
|
||||
col = index.column()
|
||||
|
||||
if role == Qt.DecorationRole:
|
||||
if col == 1:
|
||||
# status
|
||||
return QIcon(self._get_status_icon_path(instance))
|
||||
|
||||
elif role == Qt.DisplayRole:
|
||||
if col == 0:
|
||||
# name
|
||||
return instance.name
|
||||
elif col == 2:
|
||||
# size
|
||||
try:
|
||||
# for Rackspace instances, update flavor id with a verbose description
|
||||
return self.flavors.get(instance.extra['flavorId'])
|
||||
except KeyError:
|
||||
# fallback to libcloud size property
|
||||
if instance.size:
|
||||
return instance.size.ram
|
||||
# giveup on showing size
|
||||
return 'Unknown'
|
||||
elif col == 3:
|
||||
# devices
|
||||
count = 0
|
||||
topology = Topology.instance()
|
||||
for node in topology.nodes():
|
||||
id = node._server.instance_id or 0
|
||||
if instance.id == id:
|
||||
count += 1
|
||||
return count
|
||||
return None
|
||||
|
||||
def headerData(self, section, orientation, role=None):
|
||||
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
||||
try:
|
||||
return self._header_data[section]
|
||||
except IndexError:
|
||||
return None
|
||||
return super(InstanceTableModel, self).headerData(section, orientation, role)
|
||||
|
||||
def addInstance(self, instance):
|
||||
self.beginInsertRows(QModelIndex(), self.rowCount(), self.rowCount())
|
||||
if not len(self._instances):
|
||||
self.beginInsertColumns(QModelIndex(), 0, self._width-1)
|
||||
self.endInsertColumns()
|
||||
self._ids.append(instance.id)
|
||||
self._instances[instance.id] = instance
|
||||
self.endInsertRows()
|
||||
|
||||
def getInstance(self, index):
|
||||
"""
|
||||
Retrieve the i-th instance if index is in range
|
||||
"""
|
||||
try:
|
||||
return self._instances.get(self._ids[index])
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def removeInstance(self, instance):
|
||||
self.removeInstanceById(instance.id)
|
||||
|
||||
def removeInstanceById(self, instance_id):
|
||||
try:
|
||||
index = self._ids.index(instance_id)
|
||||
self.beginRemoveRows(QModelIndex(), index, index)
|
||||
del self._instances[instance_id]
|
||||
del self._ids[index]
|
||||
self.endRemoveRows()
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def updateInstanceFields(self, instance, field_names):
|
||||
"""
|
||||
Update model data and notify connected views
|
||||
"""
|
||||
if instance.id in self._ids:
|
||||
index = self._ids.index(instance.id)
|
||||
current = self._instances[instance.id]
|
||||
for field in field_names:
|
||||
setattr(current, field, getattr(instance, field))
|
||||
first_index = self.createIndex(index, 0)
|
||||
last_index = self.createIndex(index, self.columnCount()-1)
|
||||
self.dataChanged.emit(first_index, last_index)
|
||||
else:
|
||||
self.addInstance(instance)
|
||||
|
||||
def getInstanceById(self, instance_id):
|
||||
return self._instances.get(instance_id, None)
|
||||
|
||||
|
||||
class CloudInspectorView(QWidget, Ui_CloudInspectorView):
|
||||
"""
|
||||
Table view showing data coming from InstanceTableModel
|
||||
|
||||
Signals:
|
||||
instanceSelected(int) Emitted when users click and select an instance on the inspector.
|
||||
Param int is the ID of the instance
|
||||
"""
|
||||
instanceSelected = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent):
|
||||
super(QWidget, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._provider = None
|
||||
self._settings = None
|
||||
self._project_instances_id = []
|
||||
self._main_window = None
|
||||
|
||||
self._model = InstanceTableModel() # shortcut for self.uiInstancesTableView.model()
|
||||
self.uiInstancesTableView.setModel(self._model)
|
||||
self.uiInstancesTableView.verticalHeader().hide()
|
||||
self.uiInstancesTableView.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.uiInstancesTableView.horizontalHeader().setStretchLastSection(True)
|
||||
# connections
|
||||
self.uiInstancesTableView.customContextMenuRequested.connect(self._contextMenu)
|
||||
self.uiInstancesTableView.clicked.connect(self._rowChanged)
|
||||
self.uiCreateInstanceButton.clicked.connect(self._create_new_instance)
|
||||
|
||||
self._pollingTimer = QTimer(self)
|
||||
self._pollingTimer.timeout.connect(self._polling_slot)
|
||||
|
||||
# map flavor ids to combobox indexes
|
||||
self.flavor_index_id = []
|
||||
|
||||
# TODO: Delete me
|
||||
self._running = {}
|
||||
|
||||
def _get_flavor_index(self, flavor_id):
|
||||
try:
|
||||
return self.flavor_index_id.index(flavor_id)
|
||||
except ValueError:
|
||||
return -1
|
||||
|
||||
def load(self, main_win, instances):
|
||||
"""
|
||||
Fill the model data layer with instances retrieved through libcloud
|
||||
"""
|
||||
self._main_window = main_win
|
||||
self._provider = main_win.cloudProvider
|
||||
self._settings = main_win.cloudSettings()
|
||||
log.info('CloudInspectorView.load')
|
||||
|
||||
for i in instances:
|
||||
self._project_instances_id.append(i["id"])
|
||||
|
||||
update_thread = ListInstancesThread(self, self._provider)
|
||||
update_thread.instancesReady.connect(self._update_model)
|
||||
update_thread.start()
|
||||
self._pollingTimer.start(POLLING_TIMER)
|
||||
# fill sizes comboboxes
|
||||
for id, name in self._provider.list_flavors().items():
|
||||
self.uiCreateInstanceComboBox.addItem(name)
|
||||
self.flavor_index_id.append(id)
|
||||
# select default flavor
|
||||
new_instance_flavor = self._settings["new_instance_flavor"]
|
||||
self.uiCreateInstanceComboBox.setCurrentIndex(self._get_flavor_index(new_instance_flavor))
|
||||
|
||||
def addInstance(self, instance):
|
||||
"""
|
||||
Add a new instance to the inspector
|
||||
"""
|
||||
self._project_instances_id.append(instance.id)
|
||||
|
||||
def clear(self):
|
||||
"""
|
||||
Clear contents and stop polling timer
|
||||
"""
|
||||
self._model.clear()
|
||||
self._pollingTimer.stop()
|
||||
self._project_instances_id = []
|
||||
|
||||
def _contextMenu(self, pos):
|
||||
# create actions
|
||||
delete_action = QAction("Delete", self)
|
||||
delete_action.triggered.connect(self._deleteSelectedInstance)
|
||||
# create context menu and add actions
|
||||
menu = QMenu(self.uiInstancesTableView)
|
||||
menu.addAction(delete_action)
|
||||
# show the menu
|
||||
menu.popup(self.uiInstancesTableView.viewport().mapToGlobal(pos))
|
||||
|
||||
def _deleteSelectedInstance(self):
|
||||
"""
|
||||
Delete the instance corresponding to the selected table row
|
||||
"""
|
||||
sel = self.uiInstancesTableView.selectedIndexes()
|
||||
if len(sel) and self._provider is not None:
|
||||
index = sel[0].row()
|
||||
instance = self._model.getInstance(index)
|
||||
delete_thread = DeleteInstanceThread(self, self._provider, instance)
|
||||
delete_thread.instanceDeleted.connect(self._main_window.remove_instance_from_project)
|
||||
delete_thread.start()
|
||||
|
||||
instance.name = 'Deleting...'
|
||||
self._model.updateInstanceFields(instance, ['name',])
|
||||
|
||||
def _rowChanged(self, index):
|
||||
"""
|
||||
This slot is invoked every time users change the current selected row on the
|
||||
inspector
|
||||
"""
|
||||
selection = self.uiInstancesTableView.selectionModel().selection()
|
||||
if selection.isEmpty():
|
||||
return
|
||||
|
||||
item = selection.indexes()[0]
|
||||
if item.isValid():
|
||||
instance = self._model.getInstance(item.row())
|
||||
self.instanceSelected.emit(instance.id)
|
||||
|
||||
def _polling_slot(self):
|
||||
"""
|
||||
Sync model data with instances status
|
||||
"""
|
||||
if self._provider is None:
|
||||
return
|
||||
|
||||
update_thread = ListInstancesThread(self, self._provider)
|
||||
update_thread.instancesReady.connect(self._update_model)
|
||||
update_thread.start()
|
||||
|
||||
def _gns3server_started_slot(self, id, host_ip, start_response):
|
||||
"""
|
||||
This slot is called when the StartGNS3ServerThread succesfully started
|
||||
the server.
|
||||
|
||||
:param id: the id of the instance
|
||||
:param host_ip: the host ip of the instance
|
||||
:param start_response: the output of the server start script on the remote host
|
||||
"""
|
||||
# instance state transition: GNS3SERVER_STARTING --> GNS3SERVER_STARTED
|
||||
instance = self._model.getInstanceById(id)
|
||||
instance.state = RunningInstanceState.GNS3SERVER_STARTED
|
||||
self._model.updateInstanceFields(instance, ['state'])
|
||||
|
||||
data = ast.literal_eval(start_response)
|
||||
|
||||
# TODO: have the server return the port it is running on
|
||||
port = 8000
|
||||
|
||||
username = data['WEB_USERNAME']
|
||||
password = data['WEB_PASSWORD']
|
||||
|
||||
ssl_cert = ''.join(data['SSL_CRT'])
|
||||
ca_filename = 'cloud_server_{}.crt'.format(host_ip)
|
||||
# TODO: Move this directory into projectSettings.
|
||||
ca_dir = os.path.join(self._main_window.projectSettings()["project_files_dir"], "keys")
|
||||
ca_file = os.path.join(ca_dir, ca_filename)
|
||||
try:
|
||||
os.makedirs(ca_dir)
|
||||
except FileExistsError:
|
||||
pass
|
||||
with open(ca_file, 'wb') as ca_fh:
|
||||
ca_fh.write(ssl_cert.encode('utf-8'))
|
||||
|
||||
topology = Topology.instance()
|
||||
top_instance = topology.getInstance(id)
|
||||
top_instance.set_later_attributes(host_ip, port, ssl_cert, ca_file)
|
||||
ssh_pkey = top_instance.private_key
|
||||
|
||||
log.debug('Cloud server gns3server started.')
|
||||
wss_thread = WSConnectThread(self, self._provider, id, host_ip, port, ca_file,
|
||||
username, password, ssh_pkey, id)
|
||||
wss_thread.established.connect(self._wss_connected_slot)
|
||||
wss_thread.start()
|
||||
|
||||
def _wss_connected_slot(self, id):
|
||||
"""
|
||||
This slot is called when the WSConnectThread successfully connected to
|
||||
the websocket on the remote host
|
||||
"""
|
||||
# instance state transition: GNS3SERVER_STARTED --> WS_CONNECTED
|
||||
instance = self._model.getInstanceById(id)
|
||||
instance.state = RunningInstanceState.WS_CONNECTED
|
||||
self._model.updateInstanceFields(instance, ['state'])
|
||||
|
||||
def _get_public_ip(self, ip_list):
|
||||
"""
|
||||
Pick the ipv4 address from the list of ip addresses that the instance
|
||||
has.
|
||||
"""
|
||||
for ip in ip_list:
|
||||
log.debug('Cloud server ip {}'.format(ip))
|
||||
# Don't use the ipv6 address
|
||||
if ':' not in ip:
|
||||
log.debug('Chose {} as public ip'.format(ip))
|
||||
return ip
|
||||
return None
|
||||
|
||||
def _update_model(self, instances):
|
||||
if not instances:
|
||||
return
|
||||
|
||||
# populate underlying model if this is the first call
|
||||
if self._model.rowCount() == 0 and len(instances) > 0:
|
||||
self._populate_model(instances)
|
||||
|
||||
instance_manager = CloudInstances.instance()
|
||||
instance_manager.update_instances(instances)
|
||||
|
||||
# filter instances to only those in the current project
|
||||
project_instances = [i for i in instances if i.id in self._project_instances_id]
|
||||
for i in project_instances:
|
||||
if i.state != RunningInstanceState.RUNNING:
|
||||
self._model.updateInstanceFields(i, ['state'])
|
||||
|
||||
# cleanup removed instances
|
||||
real = set(i.id for i in project_instances)
|
||||
current = set(self._model.instanceIds)
|
||||
for i in current.difference(real):
|
||||
self._model.removeInstanceById(i)
|
||||
self.uiInstancesTableView.resizeColumnsToContents()
|
||||
|
||||
# start gns3server if needed
|
||||
for i in project_instances:
|
||||
# get the real instance state from self._model
|
||||
model_instance = self._model.getInstanceById(i.id)
|
||||
|
||||
if model_instance.state == RunningInstanceState.RUNNING:
|
||||
# instance state transition: RUNNING --> GNS3SERVER_STARTING
|
||||
model_instance.state = RunningInstanceState.GNS3SERVER_STARTING
|
||||
self._model.updateInstanceFields(model_instance, ['state'])
|
||||
|
||||
# start GNS3 server and deadman switch
|
||||
public_ip = self._get_public_ip(i.public_ips)
|
||||
instance_manager.update_host_for_instance(i.id, public_ip)
|
||||
topology_instance = instance_manager.get_instance(i.id)
|
||||
ssh_thread = StartGNS3ServerThread(
|
||||
self, public_ip, topology_instance.private_key, i.id,
|
||||
self._provider.username, self._provider.api_key, self._provider.region,
|
||||
1800)
|
||||
ssh_thread.gns3server_started.connect(self._gns3server_started_slot)
|
||||
ssh_thread.start()
|
||||
|
||||
def _populate_model(self, instances):
|
||||
log.info('CloudInspectorView._populate_model')
|
||||
self._model.flavors = self._provider.list_flavors()
|
||||
# filter instances for current project
|
||||
project_instances = [i for i in instances if i.id in self._project_instances_id]
|
||||
for i in project_instances:
|
||||
self._model.addInstance(i)
|
||||
self.uiInstancesTableView.resizeColumnsToContents()
|
||||
|
||||
def _create_new_instance(self):
|
||||
idx = self.uiCreateInstanceComboBox.currentIndex()
|
||||
flavor_id = self.flavor_index_id[idx]
|
||||
image_id = self._settings['default_image']
|
||||
|
||||
name, ok = QInputDialog.getText(self,
|
||||
"New instance",
|
||||
"Choose a name for the instance and press Ok,\n"
|
||||
"then wait for the instance to appear in the inspector.")
|
||||
|
||||
if ok:
|
||||
if not name.endswith("-gns3"):
|
||||
name += "-gns3"
|
||||
|
||||
create_thread = CreateInstanceThread(self, self._provider, name, flavor_id, image_id)
|
||||
create_thread.instanceCreated.connect(self._main_window.add_instance_to_project)
|
||||
create_thread.instanceCreated.connect(CloudInstances.instance().add_instance)
|
||||
create_thread.start()
|
||||
@@ -1,145 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Keeps track of all cloud instances the app has started.
|
||||
"""
|
||||
|
||||
from .qt import QtCore
|
||||
from gns3.topology import TopologyInstance
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CloudInstances(QtCore.QObject):
|
||||
"""
|
||||
This class stores the instances that gns3 gui has started. This can be different than the list
|
||||
of instances in the topology that can be changed when switching projects. This list is not touched
|
||||
when switching projects and is stored in the .ini file.
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CloudInstances, self).__init__(*args, **kwargs)
|
||||
self._instances = []
|
||||
|
||||
|
||||
@staticmethod
|
||||
def instance():
|
||||
"""
|
||||
Singleton to return only one instance of CloudInstances.
|
||||
|
||||
:returns: instance of CloudInstances
|
||||
"""
|
||||
|
||||
if not hasattr(CloudInstances, "_instance"):
|
||||
CloudInstances._instance = CloudInstances()
|
||||
return CloudInstances._instance
|
||||
|
||||
@property
|
||||
def instances(self):
|
||||
return self._instances
|
||||
|
||||
def clear(self):
|
||||
self._instances.clear()
|
||||
|
||||
def add(self, topology_instance):
|
||||
self._instances.append(topology_instance)
|
||||
|
||||
def add_instance(self, instance, keypair):
|
||||
if instance is None:
|
||||
return
|
||||
ti = TopologyInstance(instance.name, instance.id, instance.extra['flavorId'],
|
||||
instance.extra['imageId'], keypair.private_key, keypair.public_key)
|
||||
self._instances.append(ti)
|
||||
self.save()
|
||||
|
||||
def update_instances(self, instances):
|
||||
save_needed = False
|
||||
# Look for instances that have been deleted
|
||||
for static in self._instances:
|
||||
found = False
|
||||
for dynamic in instances:
|
||||
if static.id == dynamic.id:
|
||||
found = True
|
||||
break
|
||||
|
||||
if not found:
|
||||
self._instances.remove(static)
|
||||
save_needed = True
|
||||
|
||||
if save_needed:
|
||||
self.save()
|
||||
|
||||
def update_host_for_instance(self, instance_id, host):
|
||||
for instance in self.instances:
|
||||
if instance.id == instance_id:
|
||||
if instance.host != host:
|
||||
instance.host = host
|
||||
self.save()
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
Save the list of cloud instances to the config file
|
||||
"""
|
||||
log.debug('Saving cloud instances')
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup("CloudInstances")
|
||||
settings.remove("")
|
||||
|
||||
# Save the instances
|
||||
settings.beginWriteArray("cloud_instance", len(self._instances))
|
||||
index = 0
|
||||
for instance in self._instances:
|
||||
settings.setArrayIndex(index)
|
||||
for name in instance.fields():
|
||||
value = getattr(instance, name) if not None else ""
|
||||
log.debug('{}={}'.format(name, str(value)[0:60]))
|
||||
settings.setValue(name, value)
|
||||
index += 1
|
||||
settings.endArray()
|
||||
settings.endGroup()
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load instance info from the config file to the topology
|
||||
"""
|
||||
log.debug('Loading cloud instances')
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup("CloudInstances")
|
||||
|
||||
# Load the instances
|
||||
size = settings.beginReadArray("cloud_instance")
|
||||
for index in range(0, size):
|
||||
settings.setArrayIndex(index)
|
||||
info = {}
|
||||
for name in TopologyInstance.fields():
|
||||
value = settings.value(name, "")
|
||||
log.debug('{}={}'.format(name, str(value)[0:60]))
|
||||
info[name] = value
|
||||
ti = TopologyInstance(**info)
|
||||
self._instances.append(ti)
|
||||
|
||||
def get_instance(self, instance_id):
|
||||
"""
|
||||
Retrieve a TopologyInstance objects if present
|
||||
"""
|
||||
for i in self._instances:
|
||||
if i.id == instance_id:
|
||||
return i
|
||||
return None
|
||||
@@ -6,7 +6,7 @@ no service password-encryption
|
||||
hostname %h
|
||||
!
|
||||
ip cef
|
||||
no ip domain lookup
|
||||
no ip domain-lookup
|
||||
no ip icmp rate-limit unreachable
|
||||
ip tcp synwait 5
|
||||
no cdp log mismatch duplex
|
||||
|
||||
@@ -8,7 +8,7 @@ hostname %h
|
||||
!
|
||||
ip cef
|
||||
no ip routing
|
||||
no ip domain lookup
|
||||
no ip domain-lookup
|
||||
no ip icmp rate-limit unreachable
|
||||
ip tcp synwait 5
|
||||
no cdp log mismatch duplex
|
||||
|
||||
@@ -30,83 +30,83 @@ ip tcp synwait-time 5
|
||||
!
|
||||
interface Ethernet0/0
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet0/1
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet0/2
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet0/3
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet1/0
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet1/1
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet1/2
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Ethernet1/3
|
||||
no ip address
|
||||
shutdown
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial2/0
|
||||
interface Ethernet2/0
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial2/1
|
||||
interface Ethernet2/1
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial2/2
|
||||
interface Ethernet2/2
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial2/3
|
||||
interface Ethernet2/3
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial3/0
|
||||
interface Ethernet3/0
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial3/1
|
||||
interface Ethernet3/1
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial3/2
|
||||
interface Ethernet3/2
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Serial3/3
|
||||
interface Ethernet3/3
|
||||
no ip address
|
||||
shutdown
|
||||
serial restart-delay 0
|
||||
no shutdown
|
||||
duplex auto
|
||||
!
|
||||
interface Vlan1
|
||||
no ip address
|
||||
@@ -13,7 +13,7 @@ no ip icmp rate-limit unreachable
|
||||
!
|
||||
!
|
||||
ip cef
|
||||
no ip domain lookup
|
||||
no ip domain-lookup
|
||||
!
|
||||
!
|
||||
ip tcp synwait-time 5
|
||||
@@ -28,14 +28,14 @@ import json
|
||||
from .qt import QtCore
|
||||
from .node import Node
|
||||
from .version import __version__
|
||||
try:
|
||||
from gns3converter import __version__ as gns3converter_version
|
||||
except ImportError:
|
||||
gns3converter_version = "Not installed"
|
||||
|
||||
|
||||
class ConsoleCmd(cmd.Cmd):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
cmd.Cmd.__init__(self)
|
||||
|
||||
def do_version(self, args):
|
||||
"""
|
||||
Show the version of GNS3 and its dependencies.
|
||||
@@ -45,6 +45,7 @@ class ConsoleCmd(cmd.Cmd):
|
||||
if hasattr(sys, "frozen"):
|
||||
compiled = "(compiled)"
|
||||
print("GNS3 version is {} {}".format(__version__, compiled))
|
||||
print("GNS3 Converter version is {}".format(gns3converter_version))
|
||||
print("Python version is {}.{}.{} ({}-bit) with {} encoding".format(sys.version_info[0],
|
||||
sys.version_info[1],
|
||||
sys.version_info[2],
|
||||
@@ -189,7 +190,7 @@ class ConsoleCmd(cmd.Cmd):
|
||||
|
||||
name = node.name()
|
||||
console_port = node.console()
|
||||
console_host = node.server().host
|
||||
console_host = node.server().host()
|
||||
try:
|
||||
from .telnet_console import telnetConsole
|
||||
telnetConsole(name, console_host, console_port)
|
||||
@@ -210,16 +211,15 @@ class ConsoleCmd(cmd.Cmd):
|
||||
ch = logging.StreamHandler(sys.stdout)
|
||||
|
||||
if len(args) == 1:
|
||||
try:
|
||||
level = int(args[0])
|
||||
if level == 0:
|
||||
print("Deactivating debugging")
|
||||
root.removeHandler(ch)
|
||||
else:
|
||||
print("Activating debugging")
|
||||
root.addHandler(ch)
|
||||
except:
|
||||
print(self.do_debug.__doc__)
|
||||
level = int(args[0])
|
||||
if level == 0:
|
||||
print("Deactivating debugging")
|
||||
root.removeHandler(ch)
|
||||
else:
|
||||
print("Activating debugging")
|
||||
root.addHandler(ch)
|
||||
from .main_window import MainWindow
|
||||
MainWindow.instance().setSettings({"debug_level": level})
|
||||
else:
|
||||
print(self.do_debug.__doc__)
|
||||
|
||||
@@ -259,6 +259,10 @@ class ConsoleCmd(cmd.Cmd):
|
||||
:param params: list of parameters
|
||||
"""
|
||||
|
||||
if self._topology.project is None:
|
||||
print("Sorry, the project hasn't been saved yet")
|
||||
return
|
||||
|
||||
topology = self._topology.dump()
|
||||
if len(params) == 1:
|
||||
# print out whole topology
|
||||
|
||||
@@ -19,6 +19,9 @@ import platform
|
||||
import sys
|
||||
import struct
|
||||
import inspect
|
||||
import datetime
|
||||
|
||||
from .qt import QtCore
|
||||
from .topology import Topology
|
||||
from .version import __version__
|
||||
from .console_cmd import ConsoleCmd
|
||||
@@ -36,12 +39,13 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
|
||||
# Set introduction message
|
||||
bitness = struct.calcsize("P") * 8
|
||||
self.intro = "GNS3 management console. Running GNS3 version {} on {} ({}-bit).\n" \
|
||||
"Copyright (c) 2006-2014 GNS3 Technologies.".format(__version__, platform.system(), bitness)
|
||||
current_year = datetime.date.today().year
|
||||
self.intro = "GNS3 management console. Running GNS3 version {} on {} ({}-bit) with Qt {}.\n" \
|
||||
"Copyright (c) 2006-{} GNS3 Technologies.".format(__version__, platform.system(), bitness, QtCore.QT_VERSION_STR, current_year)
|
||||
|
||||
# Parent class initialization
|
||||
try:
|
||||
PyCutExt.__init__(self, None, self.intro, parent=parent)
|
||||
super().__init__(None, self.intro, parent=parent)
|
||||
|
||||
# dynamically get all the available commands so we can color them
|
||||
methods = inspect.getmembers(self, predicate=inspect.ismethod)
|
||||
@@ -69,7 +73,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
For exception handling purposes
|
||||
(see exception hook in the program entry point).
|
||||
"""
|
||||
|
||||
|
||||
return False
|
||||
|
||||
def onKeyPress_Tab(self):
|
||||
@@ -83,7 +87,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
|
||||
if len(self.line) > 0:
|
||||
cmd, args, _ = self.parseline(line)
|
||||
if cmd == '':
|
||||
if cmd is None or cmd == '':
|
||||
compfunc = self.completedefault
|
||||
else:
|
||||
try:
|
||||
@@ -170,7 +174,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
self.write(text, warning=True)
|
||||
self.write("\n")
|
||||
|
||||
def writeServerError(self, node_id, code, message):
|
||||
def writeServerError(self, node_id, message):
|
||||
"""
|
||||
Write server error messages coming from the server.
|
||||
|
||||
@@ -181,15 +185,14 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
|
||||
node = Topology.instance().getNode(node_id)
|
||||
server = name = ""
|
||||
if node and node.name():
|
||||
name = " {}:".format(node.name())
|
||||
server = "from {}:{}".format(node.server().host,
|
||||
node.server().port)
|
||||
if node:
|
||||
if node.name():
|
||||
name = " {}:".format(node.name())
|
||||
server = "from {}".format(node.server().url())
|
||||
|
||||
text = "Server error [{code}] {server}:{name} {message}".format(code=code,
|
||||
server=server,
|
||||
name=name,
|
||||
message=message)
|
||||
text = "Server error {server}:{name} {message}".format(server=server,
|
||||
name=name,
|
||||
message=message)
|
||||
self.write(text, error=True)
|
||||
self.write("\n")
|
||||
|
||||
@@ -203,12 +206,12 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
self.pointer = 0
|
||||
if len(self.line):
|
||||
self.history.append(self.line)
|
||||
try:
|
||||
self.lines.append(self.line)
|
||||
source = "\n".join(self.lines)
|
||||
self.more = self.onecmd(source)
|
||||
except Exception as e:
|
||||
print("Unknown error: {}".format(e))
|
||||
try:
|
||||
self.lines.append(self.line)
|
||||
source = "\n".join(self.lines)
|
||||
self.more = self.onecmd(source)
|
||||
except Exception as e:
|
||||
print("Unknown error: {}".format(e))
|
||||
|
||||
self.write(self.prompt)
|
||||
self.lines = []
|
||||
|
||||
120
gns3/crash_report.py
Normal file
120
gns3/crash_report.py
Normal file
@@ -0,0 +1,120 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
import struct
|
||||
|
||||
try:
|
||||
import raven
|
||||
RAVEN_AVAILABLE = True
|
||||
except ImportError:
|
||||
# raven is not installed with deb package in order to simplify packaging
|
||||
RAVEN_AVAILABLE = False
|
||||
|
||||
from .utils.get_resource import get_resource
|
||||
from .version import __version__
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Dev build
|
||||
if __version__[4] != 0:
|
||||
import faulthandler
|
||||
# Display a traceback in case of segfault crash. Usefull when frozen
|
||||
# Not enabled by default for security reason
|
||||
log.info("Enable catching segfault")
|
||||
faulthandler.enable()
|
||||
|
||||
|
||||
class CrashReport:
|
||||
|
||||
"""
|
||||
Report crash to a third party service
|
||||
"""
|
||||
|
||||
DSN = "sync+https://a86f12c42f7746288a81af9a9c1145a4:db8b6973bd2c448ea0a98675119ff8ee@app.getsentry.com/38506"
|
||||
if hasattr(sys, "frozen"):
|
||||
cacert = get_resource("cacert.pem")
|
||||
if cacert is not None and os.path.isfile(cacert):
|
||||
DSN += "?ca_certs={}".format(cacert)
|
||||
else:
|
||||
log.warning("The SSL certificate bundle file '{}' could not be found".format(cacert))
|
||||
_instance = None
|
||||
|
||||
def __init__(self):
|
||||
self._client = None
|
||||
|
||||
# We don't want sentry making noise if an error is catched when you don't have internet
|
||||
sentry_errors = logging.getLogger('sentry.errors')
|
||||
sentry_errors.disabled = True
|
||||
|
||||
sentry_uncaught = logging.getLogger('sentry.errors.uncaught')
|
||||
sentry_uncaught.disabled = True
|
||||
|
||||
def captureException(self, exception, value, tb):
|
||||
if not RAVEN_AVAILABLE:
|
||||
return
|
||||
if os.path.exists(".git"):
|
||||
log.warning("A .git directory exist crash report is turn off for developers")
|
||||
return
|
||||
from .servers import Servers
|
||||
|
||||
local_server = Servers.instance().localServerSettings()
|
||||
if local_server["report_errors"]:
|
||||
if self._client is None:
|
||||
self._client = raven.Client(CrashReport.DSN, release=__version__)
|
||||
context = {
|
||||
"os:name": platform.system(),
|
||||
"os:release": platform.release(),
|
||||
"os:win_32": " ".join(platform.win32_ver()),
|
||||
"os:mac": "{} {}".format(platform.mac_ver()[0], platform.mac_ver()[2]),
|
||||
"os:linux": " ".join(platform.linux_distribution()),
|
||||
"python:version": "{}.{}.{}".format(sys.version_info[0],
|
||||
sys.version_info[1],
|
||||
sys.version_info[2]),
|
||||
"python:bit": struct.calcsize("P") * 8,
|
||||
"python:encoding": sys.getdefaultencoding(),
|
||||
"python:frozen": "{}".format(hasattr(sys, "frozen"))
|
||||
}
|
||||
context = self._add_qt_informations(context)
|
||||
self._client.tags_context(context)
|
||||
try:
|
||||
report = self._client.captureException((exception, value, tb))
|
||||
except Exception as e:
|
||||
log.error("Can't send crash report to Sentry: {}".format(e))
|
||||
return
|
||||
log.info("Crash report sent with event ID: {}".format(self._client.get_ident(report)))
|
||||
|
||||
def _add_qt_informations(self, context):
|
||||
try:
|
||||
from .qt import QtCore
|
||||
import sip
|
||||
except ImportError:
|
||||
return context
|
||||
context["pyqt:version"] = QtCore.PYQT_VERSION_STR
|
||||
context["qt:version"] = QtCore.QT_VERSION_STR
|
||||
context["sip:version"] = sip.SIP_VERSION_STR
|
||||
return context
|
||||
|
||||
@classmethod
|
||||
def instance(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = CrashReport()
|
||||
return cls._instance
|
||||
@@ -15,19 +15,20 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ..qt import QtGui
|
||||
from ..qt import QtWidgets
|
||||
from ..version import __version__
|
||||
from ..ui.about_dialog_ui import Ui_AboutDialog
|
||||
|
||||
|
||||
class AboutDialog(QtGui.QDialog, Ui_AboutDialog):
|
||||
class AboutDialog(QtWidgets.QDialog, Ui_AboutDialog):
|
||||
|
||||
"""
|
||||
About dialog.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
# dynamically add the current version number
|
||||
|
||||
@@ -19,11 +19,13 @@
|
||||
Dialog to configure and update node settings using widget pages.
|
||||
"""
|
||||
|
||||
from ..qt import QtGui
|
||||
from ..qt import QtWidgets
|
||||
from ..ui.configuration_dialog_ui import Ui_configurationDialog
|
||||
from .node_configurator_dialog import ConfigurationError
|
||||
from .node_properties_dialog import ConfigurationError
|
||||
|
||||
|
||||
class ConfigurationDialog(QtWidgets.QDialog, Ui_configurationDialog):
|
||||
|
||||
class ConfigurationDialog(QtGui.QDialog, Ui_configurationDialog):
|
||||
"""
|
||||
Configuration dialog implementation.
|
||||
|
||||
@@ -35,7 +37,7 @@ class ConfigurationDialog(QtGui.QDialog, Ui_configurationDialog):
|
||||
|
||||
def __init__(self, name, settings, configuration_page, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.uiTitleLabel.setText(name)
|
||||
@@ -53,12 +55,11 @@ class ConfigurationDialog(QtGui.QDialog, Ui_configurationDialog):
|
||||
:param button: button that was clicked (QAbstractButton)
|
||||
"""
|
||||
|
||||
if button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Cancel):
|
||||
QtGui.QDialog.reject(self)
|
||||
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel):
|
||||
QtWidgets.QDialog.reject(self)
|
||||
else:
|
||||
try:
|
||||
self._configuration_page.saveSettings(self._settings)
|
||||
except ConfigurationError:
|
||||
return
|
||||
QtGui.QDialog.accept(self)
|
||||
|
||||
QtWidgets.QDialog.accept(self)
|
||||
|
||||
@@ -15,18 +15,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets
|
||||
from ..ui.exec_command_dialog_ui import Ui_ExecCommandDialog
|
||||
|
||||
|
||||
class ExecCommandDialog(QtGui.QDialog, Ui_ExecCommandDialog):
|
||||
class ExecCommandDialog(QtWidgets.QDialog, Ui_ExecCommandDialog):
|
||||
|
||||
"""
|
||||
Execute a command and display its output.
|
||||
"""
|
||||
|
||||
def __init__(self, parent, command, params):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWindowTitle("Executing {}".format(command))
|
||||
@@ -56,4 +57,4 @@ class ExecCommandDialog(QtGui.QDialog, Ui_ExecCommandDialog):
|
||||
|
||||
self._process.kill()
|
||||
self._process.waitForFinished()
|
||||
QtGui.QDialog.done(self, result)
|
||||
super().done(result)
|
||||
|
||||
@@ -17,34 +17,38 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pkg_resources
|
||||
|
||||
from ..qt import QtCore, QtGui, QtWebKit
|
||||
from ..qt import QtCore, QtGui, QtWebKitWidgets, QtWidgets
|
||||
from ..ui.getting_started_dialog_ui import Ui_GettingStartedDialog
|
||||
from ..utils.get_resource import get_resource
|
||||
from ..local_config import LocalConfig
|
||||
|
||||
|
||||
class GettingStartedDialog(QtGui.QDialog, Ui_GettingStartedDialog):
|
||||
class GettingStartedDialog(QtWidgets.QDialog, Ui_GettingStartedDialog):
|
||||
|
||||
"""
|
||||
GettingStarted dialog.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.uiWebView.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.uiWebView.page().mainFrame().setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.adjustSize()
|
||||
self.uiWebView.page().setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateAllLinks)
|
||||
self.uiWebView.page().setLinkDelegationPolicy(QtWebKitWidgets.QWebPage.DelegateAllLinks)
|
||||
self.uiWebView.linkClicked.connect(self._urlClickedSlot)
|
||||
self.uiWebView.loadFinished.connect(self._loadFinishedSlot)
|
||||
self.uiCheckBox.setChecked(QtCore.QSettings().value("GUI/hide_getting_started_dialog", False, type=bool))
|
||||
self._timer = QtCore.QTimer(self)
|
||||
self._timer.timeout.connect(self._loadFinishedSlot)
|
||||
self._timer.setSingleShot(True)
|
||||
self._timer.start(5000)
|
||||
self.uiWebView.load(QtCore.QUrl("http://start.gns3.net"))
|
||||
self._local_config = LocalConfig.instance()
|
||||
settings = parent.settings()
|
||||
self.uiCheckBox.setChecked(settings["hide_getting_started_dialog"])
|
||||
getting_started = get_resource(os.path.join("static", "getting_started.html"))
|
||||
if getting_started and not (sys.platform.startswith("win") and not sys.maxsize > 2 ** 32):
|
||||
# do not show the page on Windows 32-bit (crash when no Internet connection)
|
||||
self.uiWebView.load(QtCore.QUrl.fromLocalFile(getting_started))
|
||||
else:
|
||||
self.uiCheckBox.setChecked(True)
|
||||
self.accept()
|
||||
|
||||
def showit(self):
|
||||
"""
|
||||
@@ -62,8 +66,10 @@ class GettingStartedDialog(QtGui.QDialog, Ui_GettingStartedDialog):
|
||||
:param result: ignored
|
||||
"""
|
||||
|
||||
QtCore.QSettings().setValue("GUI/hide_getting_started_dialog", self.uiCheckBox.isChecked())
|
||||
QtGui.QDialog.done(self, result)
|
||||
settings = self.parentWidget().settings()
|
||||
settings["hide_getting_started_dialog"] = self.uiCheckBox.isChecked()
|
||||
self.parentWidget().setSettings(settings)
|
||||
super().done(result)
|
||||
|
||||
def _urlClickedSlot(self, url):
|
||||
"""
|
||||
@@ -73,30 +79,4 @@ class GettingStartedDialog(QtGui.QDialog, Ui_GettingStartedDialog):
|
||||
"""
|
||||
|
||||
if QtGui.QDesktopServices.openUrl(url) is False:
|
||||
QtGui.QMessageBox.critical(self, "Getting started", "Failed to open the URL: {}".format(url))
|
||||
|
||||
def _loadFinishedSlot(self, result=False):
|
||||
"""
|
||||
Slot called when the web page has been loaded.
|
||||
|
||||
:param result: boolean
|
||||
"""
|
||||
|
||||
self.uiWebView.loadFinished.disconnect(self._loadFinishedSlot)
|
||||
self._timer.stop()
|
||||
self._timer.timeout.disconnect()
|
||||
if result is False:
|
||||
# load a local resource if the page is not available
|
||||
resource_name = os.path.join("static", "getting_started.html")
|
||||
getting_started = None
|
||||
if hasattr(sys, "frozen") and os.path.isfile(resource_name):
|
||||
getting_started = os.path.normpath(resource_name)
|
||||
elif pkg_resources.resource_exists("gns3", resource_name):
|
||||
getting_started_page = pkg_resources.resource_filename("gns3", resource_name)
|
||||
getting_started = os.path.normpath(getting_started_page)
|
||||
if getting_started and not (sys.platform.startswith("win") and not sys.maxsize > 2 ** 32):
|
||||
# do not show the page on Windows 32-bit (crash when no Internet connection)
|
||||
self.uiWebView.load(QtCore.QUrl("file://{}".format(getting_started)))
|
||||
else:
|
||||
self.uiCheckBox.setChecked(True)
|
||||
self.accept()
|
||||
QtWidgets.QMessageBox.critical(self, "Getting started", "Failed to open the URL: {}".format(url))
|
||||
|
||||
@@ -15,24 +15,26 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from ..qt import QtGui
|
||||
from ..qt import QtWidgets
|
||||
from ..topology import Topology
|
||||
from ..ui.idlepc_dialog_ui import Ui_IdlePCDialog
|
||||
|
||||
|
||||
class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
class IdlePCDialog(QtWidgets.QDialog, Ui_IdlePCDialog):
|
||||
|
||||
"""
|
||||
Idle-PC dialog.
|
||||
"""
|
||||
|
||||
def __init__(self, router, idlepcs, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applySlot)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self._helpSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applySlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self._helpSlot)
|
||||
|
||||
self._router = router
|
||||
self._idlepcs = idlepcs
|
||||
@@ -51,11 +53,13 @@ class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
Shows the help for Idle-PC.
|
||||
"""
|
||||
|
||||
help_text = "Finding the right idlepc value is a trial and error process, consisting of applying " \
|
||||
"different Idle-PC values and monitoring the CPU usage.\n\nBest Idle-PC values are usually " \
|
||||
"obtained when IOS is in idle state, the following message being displayed " \
|
||||
"on the console: {} con0 is now available ... Press RETURN to get started.".format(self._router.name())
|
||||
QtGui.QMessageBox.information(self, "Hints for Idle-PC", help_text)
|
||||
help_text = """Best Idle-PC values are obtained when IOS is in idle state, after the "Press RETURN to get started" message has appeared on the console, messages have finished displaying on the console and you have have actually pressed the RETURN key.
|
||||
|
||||
Finding the right idle-pc value is a trial and error process, consisting of applying different Idle-PC values and monitoring the CPU usage.
|
||||
|
||||
Select each value that appears in the list and click Apply, and note the CPU usage a few moments later. When you have found the value that minimises the CPU usage, apply that value.
|
||||
"""
|
||||
QtWidgets.QMessageBox.information(self, "Hints for Idle-PC", help_text)
|
||||
|
||||
def _applySlot(self):
|
||||
"""
|
||||
@@ -63,17 +67,19 @@ class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
"""
|
||||
|
||||
if not self.uiComboBox.count():
|
||||
QtGui.QMessageBox.critical(self, "Idle-PC", "Sorry could not find a valid Idle-PC value, please check again with Cisco IOS in a different state")
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC", "Sorry could not find a valid Idle-PC value, please check again with Cisco IOS in a different state")
|
||||
return
|
||||
|
||||
idlepc = self.uiComboBox.itemData(self.uiComboBox.currentIndex())
|
||||
|
||||
# apply Idle-PC to all routers with the same IOS image
|
||||
ios_image = self._router.settings()["image"]
|
||||
ios_image = os.path.basename(self._router.settings()["image"])
|
||||
for node in Topology.instance().nodes():
|
||||
if hasattr(node, "idlepcs") and node.settings()["image"] == ios_image:
|
||||
if hasattr(node, "idlepc") and node.settings()["image"] == ios_image:
|
||||
node.setIdlepc(idlepc)
|
||||
|
||||
# apply the idle-pc to templates with the same IOS image
|
||||
self._router.module().updateImageIdlepc(ios_image, idlepc)
|
||||
|
||||
def done(self, result):
|
||||
"""
|
||||
Called when the dialog is closed.
|
||||
@@ -83,5 +89,4 @@ class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
|
||||
if result:
|
||||
self._applySlot()
|
||||
QtGui.QDialog.done(self, result)
|
||||
|
||||
super().done(result)
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
"""
|
||||
Dialog for importing cloud projects
|
||||
"""
|
||||
|
||||
from ..ui.import_cloud_project_dialog_ui import Ui_ImportCloudProjectDialog
|
||||
from ..qt import QtGui
|
||||
from ..cloud.utils import get_cloud_projects, DownloadProjectThread, DeleteProjectThread
|
||||
from ..utils.progress_dialog import ProgressDialog
|
||||
|
||||
|
||||
class ImportCloudProjectDialog(QtGui.QDialog, Ui_ImportCloudProjectDialog):
|
||||
"""
|
||||
Import cloud project dialog implementation.
|
||||
"""
|
||||
|
||||
def __init__(self, parent, project_dest_path, images_dest_path, cloud_settings):
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.project_dest_path = project_dest_path
|
||||
self.images_dest_path = images_dest_path
|
||||
self.cloud_settings = cloud_settings
|
||||
|
||||
self.uiImportProjectAction.clicked.connect(self._importProject)
|
||||
self.uiDeleteProjectAction.clicked.connect(self._deleteProject)
|
||||
self._listCloudProjects()
|
||||
|
||||
def _listCloudProjects(self):
|
||||
self.listWidget.clear()
|
||||
self.projects = get_cloud_projects(self.cloud_settings)
|
||||
self.listWidget.addItems(list(self.projects.keys()))
|
||||
|
||||
def _importProject(self):
|
||||
project_file_name = self.projects[self.listWidget.currentItem().text()]
|
||||
|
||||
download_thread = DownloadProjectThread(
|
||||
project_file_name,
|
||||
self.project_dest_path,
|
||||
self.images_dest_path,
|
||||
self.cloud_settings
|
||||
)
|
||||
progress_dialog = ProgressDialog(download_thread, "Importing project", "Downloading project files...", "Cancel",
|
||||
parent=self.parent())
|
||||
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
|
||||
self.close()
|
||||
|
||||
def _deleteProject(self):
|
||||
project_file_name = self.projects[self.listWidget.currentItem().text()]
|
||||
|
||||
button_clicked = QtGui.QMessageBox.question(
|
||||
self,
|
||||
"Delete project",
|
||||
"Are you sure you want to delete project " + self.listWidget.currentItem().text(),
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No,
|
||||
QtGui.QMessageBox.Yes
|
||||
)
|
||||
|
||||
if button_clicked == QtGui.QMessageBox.Yes:
|
||||
delete_project_thread = DeleteProjectThread(project_file_name, self.cloud_settings)
|
||||
progress_dialog = ProgressDialog(delete_project_thread, "Deleting project", "Deleting project files...",
|
||||
"Cancel", parent=self)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
|
||||
self._listCloudProjects()
|
||||
@@ -16,13 +16,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.new_project_dialog_ui import Ui_NewProjectDialog
|
||||
from ..settings import ENABLE_CLOUD
|
||||
|
||||
|
||||
class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
class NewProjectDialog(QtWidgets.QDialog, Ui_NewProjectDialog):
|
||||
|
||||
"""
|
||||
New project dialog.
|
||||
|
||||
@@ -33,11 +32,11 @@ class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
|
||||
def __init__(self, parent, showed_from_startup=False):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._main_window = parent
|
||||
self._project_settings = parent.projectSettings().copy()
|
||||
self._project_settings = {}
|
||||
default_project_name = "untitled"
|
||||
self.uiNameLineEdit.setText(default_project_name)
|
||||
self.uiLocationLineEdit.setText(os.path.join(self._main_window.projectsDirPath(), default_project_name))
|
||||
@@ -46,8 +45,6 @@ class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
self.uiLocationBrowserToolButton.clicked.connect(self._projectPathSlot)
|
||||
self.uiOpenProjectPushButton.clicked.connect(self._openProjectActionSlot)
|
||||
self.uiRecentProjectsPushButton.clicked.connect(self._showRecentProjectsSlot)
|
||||
if not ENABLE_CLOUD:
|
||||
self.uiCloudRadioButton.hide()
|
||||
|
||||
if not showed_from_startup:
|
||||
self.uiOpenProjectPushButton.hide()
|
||||
@@ -72,8 +69,9 @@ class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
Slot to select the a new project location.
|
||||
"""
|
||||
|
||||
path = QtGui.QFileDialog.getSaveFileName(self, "Project location", os.path.join(self._main_window.projectsDirPath(),
|
||||
self.uiNameLineEdit.text()))
|
||||
path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Project location", os.path.join(self._main_window.projectsDirPath(),
|
||||
self.uiNameLineEdit.text()))
|
||||
|
||||
if path:
|
||||
self.uiLocationLineEdit.setText(path)
|
||||
|
||||
@@ -104,7 +102,7 @@ class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
lot to show all the recent projects in a menu.
|
||||
"""
|
||||
|
||||
menu = QtGui.QMenu()
|
||||
menu = QtWidgets.QMenu()
|
||||
menu.triggered.connect(self._menuTriggeredSlot)
|
||||
for action in self._main_window._recent_file_actions:
|
||||
menu.addAction(action)
|
||||
@@ -115,34 +113,28 @@ class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
if result:
|
||||
project_name = self.uiNameLineEdit.text()
|
||||
project_location = self.uiLocationLineEdit.text()
|
||||
if self.uiCloudRadioButton.isChecked():
|
||||
project_type = "cloud"
|
||||
else:
|
||||
project_type = "local"
|
||||
project_type = "local"
|
||||
|
||||
if not project_name:
|
||||
QtGui.QMessageBox.critical(self, "New project", "Project name is empty")
|
||||
QtWidgets.QMessageBox.critical(self, "New project", "Project name is empty")
|
||||
return
|
||||
|
||||
if not project_location:
|
||||
QtGui.QMessageBox.critical(self, "New project", "Project location is empty")
|
||||
QtWidgets.QMessageBox.critical(self, "New project", "Project location is empty")
|
||||
return
|
||||
|
||||
if os.path.isdir(project_location):
|
||||
reply = QtGui.QMessageBox.question(self,
|
||||
"New project",
|
||||
"Location {} already exists, overwrite it?".format(project_location),
|
||||
QtGui.QMessageBox.Yes,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.No:
|
||||
reply = QtWidgets.QMessageBox.question(self,
|
||||
"New project",
|
||||
"Location {} already exists, overwrite it?".format(project_location),
|
||||
QtWidgets.QMessageBox.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
return
|
||||
|
||||
self._project_settings["project_name"] = project_name
|
||||
self._project_settings["project_path"] = os.path.join(project_location, project_name + ".gns3")
|
||||
self._project_settings["project_files_dir"] = os.path.join(project_location, project_name + "-files")
|
||||
self._project_settings["project_files_dir"] = project_location
|
||||
self._project_settings["project_type"] = project_type
|
||||
|
||||
# delete all the project files
|
||||
shutil.rmtree(self._project_settings["project_files_dir"], ignore_errors=True)
|
||||
|
||||
QtGui.QDialog.done(self, result)
|
||||
super().done(result)
|
||||
|
||||
@@ -19,13 +19,17 @@
|
||||
Dialog to configure and update node settings using widget pages.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..ui.node_configurator_dialog_ui import Ui_NodeConfiguratorDialog
|
||||
from gns3.http_client import HTTPClient
|
||||
from gns3.progress import Progress
|
||||
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.node_properties_dialog_ui import Ui_NodePropertiesDialog
|
||||
|
||||
|
||||
class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
|
||||
|
||||
"""
|
||||
Node configurator implementation.
|
||||
Node properties implementation.
|
||||
|
||||
:param node_items: list of NodeItem instances
|
||||
:param parent: parent widget
|
||||
@@ -33,30 +37,30 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
|
||||
def __init__(self, node_items, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._node_items = node_items
|
||||
self._parent_items = {}
|
||||
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(False)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(False)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(False)
|
||||
|
||||
self.previousItem = None
|
||||
self.previousPage = None
|
||||
|
||||
# load the empty page widget by default
|
||||
self.uiEmptyPageWidget = self.uiConfigStackedWidget.findChildren(QtGui.QWidget, "uiEmptyPageWidget")[0]
|
||||
self.uiEmptyPageWidget = self.uiConfigStackedWidget.findChildren(QtWidgets.QWidget, "uiEmptyPageWidget")[0]
|
||||
self.uiConfigStackedWidget.setCurrentWidget(self.uiEmptyPageWidget)
|
||||
|
||||
self._loadNodeItems()
|
||||
self.splitter.setSizes([250, 600])
|
||||
self._loadNodeItems()
|
||||
|
||||
self.uiNodesTreeWidget.itemClicked.connect(self.showConfigurationPageSlot)
|
||||
|
||||
def _loadNodeItems(self):
|
||||
"""
|
||||
Loads the nodes into the Node configurator QTreeWidget
|
||||
Loads the nodes into the Node properties QTreeWidget
|
||||
"""
|
||||
|
||||
# create the parent (group) items
|
||||
@@ -65,8 +69,8 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
continue
|
||||
group_name = " {} group".format(str(node_item.node()))
|
||||
parent = group_name
|
||||
if not parent in self._parent_items:
|
||||
item = QtGui.QTreeWidgetItem(self.uiNodesTreeWidget, [group_name])
|
||||
if parent not in self._parent_items:
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiNodesTreeWidget, [group_name])
|
||||
item.setIcon(0, QtGui.QIcon(node_item.node().defaultSymbol()))
|
||||
item.setExpanded(True)
|
||||
self._parent_items[parent] = item
|
||||
@@ -76,11 +80,19 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
if not node_item.node().initialized():
|
||||
continue
|
||||
parent = " {} group".format(str(node_item.node()))
|
||||
item = ConfigurationPageItem(self._parent_items[parent], node_item)
|
||||
ConfigurationPageItem(self._parent_items[parent], node_item)
|
||||
|
||||
# sort the tree
|
||||
self.uiNodesTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
|
||||
if len(self._node_items) == 1:
|
||||
parent = " {} group".format(str(node_item.node()))
|
||||
item = self._parent_items[parent].child(0)
|
||||
item.setSelected(True)
|
||||
self.uiNodesTreeWidget.setCurrentItem(item)
|
||||
self.showConfigurationPageSlot(item, 0)
|
||||
self.splitter.setSizes([0, 600])
|
||||
|
||||
def showConfigurationPageSlot(self, item, column):
|
||||
"""
|
||||
Shows a configuration page widget.
|
||||
@@ -117,11 +129,11 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
self.uiConfigStackedWidget.setCurrentWidget(page)
|
||||
|
||||
if page != self.uiEmptyPageWidget:
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(True)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(True)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(True)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(True)
|
||||
else:
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(False)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(False)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(False)
|
||||
|
||||
def on_uiButtonBox_clicked(self, button):
|
||||
"""
|
||||
@@ -131,15 +143,15 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
"""
|
||||
|
||||
try:
|
||||
if button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply):
|
||||
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply):
|
||||
self.applySettings()
|
||||
elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset):
|
||||
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset):
|
||||
self.resetSettings()
|
||||
elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Cancel):
|
||||
QtGui.QDialog.reject(self)
|
||||
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel):
|
||||
QtWidgets.QDialog.reject(self)
|
||||
else:
|
||||
self.applySettings()
|
||||
QtGui.QDialog.accept(self)
|
||||
QtWidgets.QDialog.accept(self)
|
||||
except ConfigurationError:
|
||||
pass
|
||||
|
||||
@@ -165,7 +177,7 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
page.saveSettings(settings, node, group=True)
|
||||
for index in range(0, item.childCount()):
|
||||
child = item.child(index)
|
||||
#child.node().update(settings) #TODO: delete
|
||||
# child.node().update(settings) #TODO: delete
|
||||
child.settings().update(settings)
|
||||
|
||||
# update the nodes with the settings
|
||||
@@ -200,7 +212,8 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
child.setSettings(child.node().settings().copy())
|
||||
|
||||
|
||||
class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
class ConfigurationPageItem(QtWidgets.QTreeWidgetItem):
|
||||
|
||||
"""
|
||||
Item for the QTreeWidget instance.
|
||||
Store temporary node settings configured in a page widget.
|
||||
@@ -212,7 +225,7 @@ class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
def __init__(self, parent, node_item):
|
||||
|
||||
self._node = node_item.node()
|
||||
QtGui.QTreeWidgetItem.__init__(self, parent, [self._node.name()])
|
||||
super().__init__(parent, [self._node.name()])
|
||||
|
||||
# return the configuration page widget used to configure the node.
|
||||
self._page = self._node.configPage()
|
||||
@@ -233,7 +246,7 @@ class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
def page(self):
|
||||
"""
|
||||
Returns the page widget to be displayed by the node configurator.
|
||||
Returns the page widget to be displayed by the node properties dialog.
|
||||
|
||||
:returns: QWidget instance
|
||||
"""
|
||||
@@ -269,10 +282,11 @@ class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
|
||||
class ConfigurationError(Exception):
|
||||
|
||||
"""
|
||||
Exception to be raised when a configuration error occurs.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
Exception.__init__(self)
|
||||
super().__init__()
|
||||
@@ -19,17 +19,16 @@
|
||||
Dialog to load module and built-in preference pages.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets
|
||||
from ..ui.preferences_dialog_ui import Ui_PreferencesDialog
|
||||
from ..pages.server_preferences_page import ServerPreferencesPage
|
||||
from ..pages.general_preferences_page import GeneralPreferencesPage
|
||||
from ..pages.cloud_preferences_page import CloudPreferencesPage
|
||||
from ..pages.packet_capture_preferences_page import PacketCapturePreferencesPage
|
||||
from ..modules import MODULES
|
||||
from ..settings import ENABLE_CLOUD
|
||||
|
||||
|
||||
class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
|
||||
|
||||
"""
|
||||
Preferences dialog implementation.
|
||||
|
||||
@@ -38,11 +37,11 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.uiTreeWidget.currentItemChanged.connect(self._showPreferencesPageSlot)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applyPreferences)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferences)
|
||||
self._items = []
|
||||
self._loadPreferencePages()
|
||||
|
||||
@@ -60,14 +59,12 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
ServerPreferencesPage,
|
||||
PacketCapturePreferencesPage,
|
||||
]
|
||||
if ENABLE_CLOUD:
|
||||
pages.append(CloudPreferencesPage)
|
||||
|
||||
for page in pages:
|
||||
preferences_page = page()
|
||||
preferences_page = page(self)
|
||||
preferences_page.loadPreferences()
|
||||
name = preferences_page.windowTitle()
|
||||
item = QtGui.QTreeWidgetItem(self.uiTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiTreeWidget)
|
||||
item.setText(0, name)
|
||||
item.setData(0, QtCore.Qt.UserRole, preferences_page)
|
||||
self.uiStackedWidget.addWidget(preferences_page)
|
||||
@@ -81,7 +78,7 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
preferences_page = cls()
|
||||
preferences_page.loadPreferences()
|
||||
name = preferences_page.windowTitle()
|
||||
item = QtGui.QTreeWidgetItem(parent)
|
||||
item = QtWidgets.QTreeWidgetItem(parent)
|
||||
item.setText(0, name)
|
||||
item.setData(0, QtCore.Qt.UserRole, preferences_page)
|
||||
self.uiStackedWidget.addWidget(preferences_page)
|
||||
@@ -104,8 +101,12 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
current = previous
|
||||
|
||||
preferences_page = current.data(0, QtCore.Qt.UserRole)
|
||||
name = preferences_page.windowTitle()
|
||||
self.uiTitleLabel.setText("{} preferences".format(name))
|
||||
accessible_name = preferences_page.accessibleName()
|
||||
if accessible_name:
|
||||
self.uiTitleLabel.setText(accessible_name)
|
||||
else:
|
||||
name = preferences_page.windowTitle()
|
||||
self.uiTitleLabel.setText("{} preferences".format(name))
|
||||
index = self.uiStackedWidget.indexOf(preferences_page)
|
||||
widget = self.uiStackedWidget.widget(index)
|
||||
self.uiStackedWidget.setMinimumSize(widget.size())
|
||||
@@ -131,7 +132,7 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
Closes this dialog.
|
||||
"""
|
||||
|
||||
QtGui.QDialog.reject(self)
|
||||
QtWidgets.QDialog.reject(self)
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
@@ -139,9 +140,10 @@ class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
"""
|
||||
|
||||
# close the nodes dock to refresh the node list
|
||||
main_window = self.parentWidget()
|
||||
from ..main_window import MainWindow
|
||||
main_window = MainWindow.instance()
|
||||
main_window.uiNodesDockWidget.setVisible(False)
|
||||
main_window.uiNodesDockWidget.setWindowTitle("")
|
||||
|
||||
if self._applyPreferences():
|
||||
QtGui.QDialog.accept(self)
|
||||
QtWidgets.QDialog.accept(self)
|
||||
|
||||
236
gns3/dialogs/setup_wizard.py
Normal file
236
gns3/dialogs/setup_wizard.py
Normal file
@@ -0,0 +1,236 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
from gns3.qt import QtCore, QtWidgets
|
||||
from gns3.servers import Servers
|
||||
from ..gns3_vm import GNS3VM
|
||||
from ..dialogs.preferences_dialog import PreferencesDialog
|
||||
from ..ui.setup_wizard_ui import Ui_SetupWizard
|
||||
from ..utils.progress_dialog import ProgressDialog
|
||||
from ..utils.wait_for_vm_worker import WaitForVMWorker
|
||||
|
||||
|
||||
class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
|
||||
|
||||
"""
|
||||
Base class for VM wizard.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
|
||||
if sys.platform.startswith("darwin"):
|
||||
# we want to see the cancel button on OSX
|
||||
self.setOptions(QtWidgets.QWizard.NoDefaultButton)
|
||||
|
||||
self._server = Servers.instance().localServer()
|
||||
self.uiRefreshPushButton.clicked.connect(self._refreshVMListSlot)
|
||||
self.uiVmwareRadioButton.clicked.connect(self._listVMwareVMsSlot)
|
||||
self.uiVirtualBoxRadioButton.clicked.connect(self._listVirtualBoxVMsSlot)
|
||||
settings = parent.settings()
|
||||
self.uiShowCheckBox.setChecked(settings["hide_setup_wizard"])
|
||||
|
||||
# by default all radio buttons are unchecked
|
||||
self.uiVmwareRadioButton.setAutoExclusive(False)
|
||||
self.uiVirtualBoxRadioButton.setAutoExclusive(False)
|
||||
self.uiVmwareRadioButton.setChecked(False)
|
||||
self.uiVirtualBoxRadioButton.setChecked(False)
|
||||
|
||||
def _listVMwareVMsSlot(self):
|
||||
"""
|
||||
Slot to refresh the VMware VMs list.
|
||||
"""
|
||||
|
||||
self.uiVirtualBoxRadioButton.setChecked(False)
|
||||
from gns3.modules import VMware
|
||||
settings = VMware.instance().settings()
|
||||
if not os.path.exists(settings["vmrun_path"]):
|
||||
QtWidgets.QMessageBox.critical(self, "VMware", "VMware vmrun tool could not be found, VMware or the VIX API is probably not installed")
|
||||
return
|
||||
self._refreshVMListSlot()
|
||||
|
||||
def _listVirtualBoxVMsSlot(self):
|
||||
"""
|
||||
Slot to refresh the VirtualBox VMs list.
|
||||
"""
|
||||
|
||||
self.uiVmwareRadioButton.setChecked(False)
|
||||
from gns3.modules import VirtualBox
|
||||
settings = VirtualBox.instance().settings()
|
||||
if not os.path.exists(settings["vboxmanage_path"]):
|
||||
QtWidgets.QMessageBox.critical(self, "VirtualBox", "VBoxManage could not be found, VirtualBox is probably not installed")
|
||||
return
|
||||
self._refreshVMListSlot()
|
||||
|
||||
def showit(self):
|
||||
"""
|
||||
Either this dialog should be automatically showed at startup.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
return not self.uiShowCheckBox.isChecked()
|
||||
|
||||
def _setPreferencesPane(self, dialog, name):
|
||||
"""
|
||||
Finds the first child of the QTreeWidgetItem name.
|
||||
|
||||
:param dialog: PreferencesDialog instance
|
||||
:param name: QTreeWidgetItem name
|
||||
|
||||
:returns: current QWidget
|
||||
"""
|
||||
|
||||
pane = dialog.uiTreeWidget.findItems(name, QtCore.Qt.MatchFixedString)[0]
|
||||
child_pane = pane.child(0)
|
||||
dialog.uiTreeWidget.setCurrentItem(child_pane)
|
||||
return dialog.uiStackedWidget.currentWidget()
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
Validates the settings.
|
||||
"""
|
||||
|
||||
gns3_vm = GNS3VM.instance()
|
||||
servers = Servers.instance()
|
||||
if self.currentPage() == self.uiVMWizardPage:
|
||||
vmname = self.uiVMListComboBox.currentText()
|
||||
if vmname:
|
||||
# save the GNS3 VM settings
|
||||
vm_settings = {"auto_start": True,
|
||||
"vmname": vmname,
|
||||
"vmx_path": self.uiVMListComboBox.currentData()}
|
||||
if self.uiVmwareRadioButton.isChecked():
|
||||
vm_settings["virtualization"] = "VMware"
|
||||
elif self.uiVirtualBoxRadioButton.isChecked():
|
||||
vm_settings["virtualization"] = "VirtualBox"
|
||||
gns3_vm.setSettings(vm_settings)
|
||||
servers.save()
|
||||
|
||||
# start the GNS3 VM
|
||||
servers.initVMServer()
|
||||
worker = WaitForVMWorker()
|
||||
progress_dialog = ProgressDialog(worker, "GNS3 VM", "Starting the GNS3 VM...", "Cancel", busy=True, parent=self)
|
||||
progress_dialog.show()
|
||||
if progress_dialog.exec_():
|
||||
gns3_vm.adjustLocalServerIP()
|
||||
else:
|
||||
return False
|
||||
elif self.currentPage() == self.uiAddVMsWizardPage:
|
||||
|
||||
use_local_server = self.uiLocalRadioButton.isChecked()
|
||||
if use_local_server:
|
||||
# deactivate the GNS3 VM if using the local server
|
||||
vm_settings = {"auto_start": False}
|
||||
gns3_vm.setSettings(vm_settings)
|
||||
servers.save()
|
||||
from gns3.modules import Dynamips
|
||||
Dynamips.instance().setSettings({"use_local_server": use_local_server})
|
||||
if sys.platform.startswith("linux"):
|
||||
# IOU only works on Linux
|
||||
from gns3.modules import IOU
|
||||
IOU.instance().setSettings({"use_local_server": use_local_server})
|
||||
from gns3.modules import Qemu
|
||||
Qemu.instance().setSettings({"use_local_server": use_local_server})
|
||||
from gns3.modules import VPCS
|
||||
VPCS.instance().setSettings({"use_local_server": use_local_server})
|
||||
|
||||
dialog = PreferencesDialog(self)
|
||||
if self.uiAddIOSRouterCheckBox.isChecked():
|
||||
self._setPreferencesPane(dialog, "Dynamips").uiNewIOSRouterPushButton.clicked.emit(False)
|
||||
if self.uiAddIOUDeviceCheckBox.isChecked():
|
||||
self._setPreferencesPane(dialog, "IOS on UNIX").uiNewIOUDevicePushButton.clicked.emit(False)
|
||||
if self.uiAddQemuVMcheckBox.isChecked():
|
||||
self._setPreferencesPane(dialog, "QEMU").uiNewQemuVMPushButton.clicked.emit(False)
|
||||
if self.uiAddVirtualBoxVMcheckBox.isChecked():
|
||||
self._setPreferencesPane(dialog, "VirtualBox").uiNewVirtualBoxVMPushButton.clicked.emit(False)
|
||||
if self.uiAddVMwareVMcheckBox.isChecked():
|
||||
self._setPreferencesPane(dialog, "VMware").uiNewVMwareVMPushButton.clicked.emit(False)
|
||||
dialog.exec_()
|
||||
return True
|
||||
|
||||
def _refreshVMListSlot(self):
|
||||
"""
|
||||
Refresh the list of VM available in VMware or VirtualBox.
|
||||
"""
|
||||
|
||||
if not Servers.instance().localServerIsRunning():
|
||||
QtWidgets.QMessageBox.critical(self, "Local server", "{}".format("Local server is not running"))
|
||||
return
|
||||
server = Servers.instance().localServer()
|
||||
if self.uiVmwareRadioButton.isChecked():
|
||||
server.get("/vmware/vms", self._getVMsFromServerCallback)
|
||||
elif self.uiVirtualBoxRadioButton.isChecked():
|
||||
server.get("/virtualbox/vms", self._getVMsFromServerCallback)
|
||||
|
||||
def _getVMsFromServerCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for getVMsFromServer.
|
||||
|
||||
:param progress_dialog: QProgressDialog instance
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
QtWidgets.QMessageBox.critical(self, "VM List", "{}".format(result["message"]))
|
||||
else:
|
||||
self.uiVMListComboBox.clear()
|
||||
for vm in result:
|
||||
if self.uiVmwareRadioButton.isChecked():
|
||||
self.uiVMListComboBox.addItem(vm["vmname"], vm["vmx_path"])
|
||||
else:
|
||||
self.uiVMListComboBox.addItem(vm["vmname"], "")
|
||||
gns3_vm = Servers.instance().vmSettings()
|
||||
index = self.uiVMListComboBox.findText(gns3_vm["vmname"])
|
||||
if index != -1:
|
||||
self.uiVMListComboBox.setCurrentIndex(index)
|
||||
else:
|
||||
index = self.uiVMListComboBox.findText("GNS3 VM")
|
||||
if index != -1:
|
||||
self.uiVMListComboBox.setCurrentIndex(index)
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, "GNS3 VM", "Could not find a VM named 'GNS3 VM', is it imported in VMware or VirtualBox?")
|
||||
|
||||
def done(self, result):
|
||||
"""
|
||||
This dialog is closed.
|
||||
|
||||
:param result: ignored
|
||||
"""
|
||||
|
||||
settings = self.parentWidget().settings()
|
||||
settings["hide_setup_wizard"] = self.uiShowCheckBox.isChecked()
|
||||
self.parentWidget().setSettings(settings)
|
||||
super().done(result)
|
||||
|
||||
def nextId(self):
|
||||
"""
|
||||
Wizard rules!
|
||||
"""
|
||||
|
||||
current_id = self.currentId()
|
||||
if self.page(current_id) == self.uiServerWizardPage and not self.uiVMRadioButton.isChecked():
|
||||
# skip the GNS3 VM page if using the local server.
|
||||
return self.uiServerWizardPage.nextId() + 1
|
||||
return QtWidgets.QWizard.nextId(self)
|
||||
@@ -24,15 +24,16 @@ import re
|
||||
import time
|
||||
import os
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets
|
||||
from ..utils.progress_dialog import ProgressDialog
|
||||
from ..utils.process_files_thread import ProcessFilesThread
|
||||
from ..utils.process_files_worker import ProcessFilesWorker
|
||||
from ..ui.snapshots_dialog_ui import Ui_SnapshotsDialog
|
||||
from ..topology import Topology
|
||||
from ..node import Node
|
||||
|
||||
|
||||
class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
|
||||
|
||||
"""
|
||||
Snapshots dialog implementation.
|
||||
|
||||
@@ -41,11 +42,11 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
|
||||
def __init__(self, parent, project_path, project_files_dir):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._project_path = project_path
|
||||
self._project_files_dir = project_files_dir
|
||||
self._project_files_dir = os.path.join(project_files_dir, "project-files")
|
||||
|
||||
self.uiCreatePushButton.clicked.connect(self._createSnapshotSlot)
|
||||
self.uiDeletePushButton.clicked.connect(self._deleteSnapshotSlot)
|
||||
@@ -69,7 +70,7 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
snapshot_name = match.group(1)
|
||||
snapshot_date = match.group(2)[:2] + '/' + match.group(2)[2:4] + '/' + match.group(2)[4:]
|
||||
snapshot_time = match.group(3)[:2] + ':' + match.group(3)[2:4] + ':' + match.group(3)[4:]
|
||||
item = QtGui.QListWidgetItem(self.uiSnapshotsList)
|
||||
item = QtWidgets.QListWidgetItem(self.uiSnapshotsList)
|
||||
item.setText("{} on {} at {}".format(snapshot_name, snapshot_date, snapshot_time))
|
||||
item.setData(QtCore.Qt.UserRole, os.path.join(snapshot_dir, snapshot))
|
||||
|
||||
@@ -88,15 +89,14 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
Slot to create a snapshot.
|
||||
"""
|
||||
|
||||
snapshot_name, ok = QtGui.QInputDialog.getText(self, "Snapshot", "Snapshot name:", QtGui.QLineEdit.Normal, "Unnamed")
|
||||
snapshot_name, ok = QtWidgets.QInputDialog.getText(self, "Snapshot", "Snapshot name:", QtWidgets.QLineEdit.Normal, "Unnamed")
|
||||
if ok and snapshot_name:
|
||||
from ..main_window import MainWindow
|
||||
MainWindow.instance().saveProject(self._project_path)
|
||||
snapshot_name = "{name}_{date}".format(name=snapshot_name, date=time.strftime("%d%m%y_%H%M%S"))
|
||||
snapshot_dir = os.path.join(self._project_files_dir, "snapshots", snapshot_name)
|
||||
thread = ProcessFilesThread(os.path.dirname(self._project_path), snapshot_dir, skip_dirs=["snapshots"])
|
||||
thread.deleteLater()
|
||||
progress_dialog = ProgressDialog(thread, "Creating snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
worker = ProcessFilesWorker(os.path.dirname(self._project_path), snapshot_dir, skip_dirs=["snapshots"])
|
||||
progress_dialog = ProgressDialog(worker, "Creating snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
self._listSnaphosts()
|
||||
@@ -134,9 +134,9 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
snapshot_name = match.group(1)
|
||||
else:
|
||||
snapshot_name = "Unknown"
|
||||
reply = QtGui.QMessageBox.question(self, "Snapshots", "This will discard any changes made to your project since the snapshot \"{}\" was taken?".format(snapshot_name),
|
||||
QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel)
|
||||
if reply == QtGui.QMessageBox.Cancel:
|
||||
reply = QtWidgets.QMessageBox.question(self, "Snapshots", "This will discard any changes made to your project since the snapshot \"{}\" was taken?".format(snapshot_name),
|
||||
QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel)
|
||||
if reply == QtWidgets.QMessageBox.Cancel:
|
||||
return
|
||||
|
||||
# stop all the nodes
|
||||
@@ -145,15 +145,37 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
if hasattr(node, "start") and node.status() == Node.started:
|
||||
node.stop()
|
||||
|
||||
#FIXME: problably a bug when restoring a snapshot and the project name has changed.
|
||||
thread = ProcessFilesThread(snapshot_path, os.path.dirname(self._project_path), skip_dirs=["snapshots"])
|
||||
thread.deleteLater()
|
||||
progress_dialog = ProgressDialog(thread, "Restoring snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
project_name, _ = os.path.splitext(os.path.basename(self._project_path))
|
||||
legacy_project_files_dir = os.path.join(snapshot_path, "{}-files".format(project_name))
|
||||
if os.path.exists(legacy_project_files_dir):
|
||||
# support for pre 1.3 snapshots
|
||||
for root, dirs, _ in os.walk(self._project_files_dir):
|
||||
dirs[:] = [d for d in dirs if d not in "snapshots"]
|
||||
for project_subdir in dirs:
|
||||
project_subdir_path = os.path.join(root, project_subdir)
|
||||
shutil.rmtree(project_subdir_path, ignore_errors=True)
|
||||
|
||||
dirs = os.listdir(legacy_project_files_dir)
|
||||
for snapshot_subdir in dirs:
|
||||
snapshot_subdir_path = os.path.join(legacy_project_files_dir, snapshot_subdir)
|
||||
worker = ProcessFilesWorker(snapshot_subdir_path, os.path.join(self._project_files_dir, snapshot_subdir))
|
||||
progress_dialog = ProgressDialog(worker, "Restoring snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
|
||||
try:
|
||||
os.remove(self._project_path)
|
||||
shutil.copy(os.path.join(snapshot_path, os.path.basename(self._project_path)), self._project_path)
|
||||
except OSError as e:
|
||||
QtWidgets.QMessageBox.critical(self, "Restore snapshot", "Cannot restore snapshot: {}".format(e))
|
||||
else:
|
||||
worker = ProcessFilesWorker(snapshot_path, os.path.dirname(self._project_path), skip_dirs=["snapshots"])
|
||||
progress_dialog = ProgressDialog(worker, "Restoring snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
|
||||
from ..main_window import MainWindow
|
||||
MainWindow.instance().loadProject(self._project_path)
|
||||
MainWindow.instance().loadSnapshot(self._project_path)
|
||||
self.accept()
|
||||
|
||||
def _snapshotDoubleClickedSlot(self, item):
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
Style editor to edit Shape items.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets, QtGui
|
||||
from ..ui.style_editor_dialog_ui import Ui_StyleEditorDialog
|
||||
|
||||
|
||||
class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
|
||||
|
||||
"""
|
||||
Style editor dialog.
|
||||
|
||||
@@ -33,13 +34,13 @@ class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
|
||||
def __init__(self, parent, items):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._items = items
|
||||
self.uiColorPushButton.clicked.connect(self._setColorSlot)
|
||||
self.uiBorderColorPushButton.clicked.connect(self._setBorderColorSlot)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
|
||||
self.uiBorderStyleComboBox.addItem("Solid", QtCore.Qt.SolidLine)
|
||||
self.uiBorderStyleComboBox.addItem("Dash", QtCore.Qt.DashLine)
|
||||
@@ -73,7 +74,7 @@ class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
Slot to select the filling color.
|
||||
"""
|
||||
|
||||
color = QtGui.QColorDialog.getColor(self._color, self, "Select Color", QtGui.QColorDialog.ShowAlphaChannel)
|
||||
color = QtWidgets.QColorDialog.getColor(self._color, self, "Select Color", QtWidgets.QColorDialog.ShowAlphaChannel)
|
||||
if color.isValid():
|
||||
self._color = color
|
||||
self.uiColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._color.red(),
|
||||
@@ -86,7 +87,7 @@ class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
Slot to select the border color.
|
||||
"""
|
||||
|
||||
color = QtGui.QColorDialog.getColor(self._border_color, self, "Select Color", QtGui.QColorDialog.ShowAlphaChannel)
|
||||
color = QtWidgets.QColorDialog.getColor(self._border_color, self, "Select Color", QtWidgets.QColorDialog.ShowAlphaChannel)
|
||||
if color.isValid():
|
||||
self._border_color = color
|
||||
self.uiBorderColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._border_color.red(),
|
||||
@@ -117,4 +118,4 @@ class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
|
||||
if result:
|
||||
self._applyPreferencesSlot()
|
||||
QtGui.QDialog.done(self, result)
|
||||
super().done(result)
|
||||
|
||||
@@ -16,15 +16,22 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Dialog to change the topology symbol of NodeItems
|
||||
Dialog to change node symbols.
|
||||
"""
|
||||
|
||||
from ..qt import QtSvg, QtCore, QtGui
|
||||
import os
|
||||
|
||||
from ..qt import QtSvg, QtCore, QtGui, QtWidgets
|
||||
from ..items.svg_node_item import SvgNodeItem
|
||||
from ..items.pixmap_node_item import PixmapNodeItem
|
||||
from ..ui.symbol_selection_dialog_ui import Ui_SymbolSelectionDialog
|
||||
from ..node import Node
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SymbolSelectionDialog(QtGui.QDialog, Ui_SymbolSelectionDialog):
|
||||
class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
|
||||
"""
|
||||
Symbol selection dialog.
|
||||
|
||||
@@ -32,38 +39,48 @@ class SymbolSelectionDialog(QtGui.QDialog, Ui_SymbolSelectionDialog):
|
||||
:param items: list of items
|
||||
"""
|
||||
|
||||
def __init__(self, parent, items=None):
|
||||
def __init__(self, parent, items=None, symbol=None):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._items = items
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiSymbolToolButton.clicked.connect(self._symbolBrowserSlot)
|
||||
self._symbols_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.PicturesLocation)
|
||||
|
||||
selected_symbol = symbol
|
||||
if not self._items:
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).hide()
|
||||
|
||||
# current categories
|
||||
categories = {"Routers": Node.routers,
|
||||
"Switches": Node.switches,
|
||||
"End devices": Node.end_devices,
|
||||
"Security devices": Node.security_devices
|
||||
}
|
||||
|
||||
for name, category in categories.items():
|
||||
self.uiCategoryComboBox.addItem(name, category)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).hide()
|
||||
else:
|
||||
self.uiCategoryLabel.hide()
|
||||
self.uiCategoryComboBox.hide()
|
||||
first_item = items[0]
|
||||
if isinstance(first_item, SvgNodeItem):
|
||||
custom_symbol = first_item.renderer().objectName()
|
||||
if not custom_symbol:
|
||||
symbol_name = first_item.node().defaultSymbol()
|
||||
else:
|
||||
symbol_name = custom_symbol
|
||||
selected_symbol = symbol_name
|
||||
elif isinstance(first_item, PixmapNodeItem):
|
||||
self.uiSymbolLineEdit.setText(first_item.pixmapSymbolPath())
|
||||
|
||||
self.uiSymbolListWidget.setIconSize(QtCore.QSize(64, 64))
|
||||
symbol_resources = QtCore.QResource(":/symbols")
|
||||
for symbol in symbol_resources.children():
|
||||
if symbol.endswith('.normal.svg'):
|
||||
name = symbol[:-11]
|
||||
item = QtGui.QListWidgetItem(self.uiSymbolListWidget)
|
||||
if symbol.endswith(".svg"):
|
||||
name = os.path.splitext(symbol)[0]
|
||||
item = QtWidgets.QListWidgetItem(self.uiSymbolListWidget)
|
||||
item.setText(name)
|
||||
item.setIcon(QtGui.QIcon(':/symbols/' + symbol))
|
||||
resource_path = ":/symbols/" + symbol
|
||||
svg_renderer = QtSvg.QSvgRenderer(resource_path)
|
||||
if resource_path == selected_symbol:
|
||||
self.uiSymbolListWidget.setCurrentItem(item)
|
||||
image = QtGui.QImage(64, 64, QtGui.QImage.Format_ARGB32)
|
||||
# Set the ARGB to 0 to prevent rendering artifacts
|
||||
image.fill(0x00000000)
|
||||
svg_renderer.render(QtGui.QPainter(image))
|
||||
icon = QtGui.QIcon(QtGui.QPixmap.fromImage(image))
|
||||
item.setIcon(icon)
|
||||
|
||||
def _applyPreferencesSlot(self):
|
||||
"""
|
||||
@@ -73,28 +90,47 @@ class SymbolSelectionDialog(QtGui.QDialog, Ui_SymbolSelectionDialog):
|
||||
current = self.uiSymbolListWidget.currentItem()
|
||||
if current:
|
||||
name = current.text()
|
||||
path = ":/symbols/{}.normal.svg".format(name)
|
||||
default_renderer = QtSvg.QSvgRenderer(path)
|
||||
default_renderer.setObjectName(path)
|
||||
path = ":/symbols/{}.selected.svg".format(name)
|
||||
hover_renderer = QtSvg.QSvgRenderer(path)
|
||||
hover_renderer.setObjectName(path)
|
||||
path = ":/symbols/{}.svg".format(name)
|
||||
renderer = QtSvg.QSvgRenderer(path)
|
||||
renderer.setObjectName(path)
|
||||
for item in self._items:
|
||||
item.setDefaultRenderer(default_renderer)
|
||||
item.setHoverRenderer(hover_renderer)
|
||||
if isinstance(item, SvgNodeItem):
|
||||
item.setSharedRenderer(renderer)
|
||||
else:
|
||||
log.warning("Built-in SVG symbol cannot be applied on Pixmap node item")
|
||||
|
||||
def getSymbols(self):
|
||||
symbol_path = self.uiSymbolLineEdit.text()
|
||||
pixmap = QtGui.QPixmap(symbol_path)
|
||||
if not pixmap.isNull():
|
||||
for item in self._items:
|
||||
if isinstance(item, PixmapNodeItem):
|
||||
item.setPixmap(pixmap)
|
||||
else:
|
||||
log.warning("Custom pixmap symbol cannot be applied on SVG node item")
|
||||
|
||||
current = self.uiSymbolListWidget.currentItem()
|
||||
if current:
|
||||
def getSymbol(self):
|
||||
|
||||
if self.uiSymbolListWidget.isEnabled():
|
||||
current = self.uiSymbolListWidget.currentItem()
|
||||
name = current.text()
|
||||
normal_symbol = ":/symbols/{}.normal.svg".format(name)
|
||||
selected_symbol = ":/symbols/{}.selected.svg".format(name)
|
||||
return normal_symbol, selected_symbol
|
||||
normal_symbol = ":/symbols/{}.svg".format(name)
|
||||
else:
|
||||
normal_symbol = self.uiSymbolLineEdit.text()
|
||||
return normal_symbol
|
||||
|
||||
def getCategory(self):
|
||||
def _symbolBrowserSlot(self):
|
||||
|
||||
return self.uiCategoryComboBox.itemData(self.uiCategoryComboBox.currentIndex())
|
||||
# supported image file formats
|
||||
file_formats = "Image files (*.svg *.bmp *.jpeg *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;All files (*.*)"
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Image", self._symbols_dir, file_formats)
|
||||
if not path:
|
||||
return
|
||||
|
||||
self._symbols_dir = os.path.dirname(path)
|
||||
self.uiSymbolListWidget.setEnabled(False)
|
||||
self.uiSymbolLineEdit.clear()
|
||||
self.uiSymbolLineEdit.setText(path)
|
||||
self.uiSymbolLineEdit.setToolTip('<img src="{}"/>'.format(path))
|
||||
|
||||
def done(self, result):
|
||||
"""
|
||||
@@ -105,4 +141,4 @@ class SymbolSelectionDialog(QtGui.QDialog, Ui_SymbolSelectionDialog):
|
||||
|
||||
if result and self._items:
|
||||
self._applyPreferencesSlot()
|
||||
QtGui.QDialog.done(self, result)
|
||||
super().done(result)
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
Text editor to edit Note items.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets
|
||||
from ..ui.text_editor_dialog_ui import Ui_TextEditorDialog
|
||||
|
||||
|
||||
class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
|
||||
"""
|
||||
Text editor dialog.
|
||||
|
||||
@@ -33,32 +33,45 @@ class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
|
||||
def __init__(self, parent, items):
|
||||
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self._items = items
|
||||
self.uiFontPushButton.clicked.connect(self._setFontSlot)
|
||||
self.uiColorPushButton.clicked.connect(self._setColorSlot)
|
||||
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
|
||||
# use the first item in the list as the model
|
||||
first_item = items[0]
|
||||
self._color = first_item.defaultTextColor()
|
||||
self._setColor(first_item.defaultTextColor())
|
||||
self.uiRotationSpinBox.setValue(first_item.rotation())
|
||||
self.uiColorPushButton.setStyleSheet("background-color: {}".format(self._color.name()))
|
||||
self.uiPlainTextEdit.setPlainText(first_item.toPlainText())
|
||||
self.uiPlainTextEdit.setFont(first_item.font())
|
||||
self.uiPlainTextEdit.setStyleSheet("color : {}".format(self._color.name()))
|
||||
|
||||
if not first_item.editable():
|
||||
self.uiPlainTextEdit.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
|
||||
|
||||
if len(self._items) == 1:
|
||||
self.uiApplyTextToAllItemsCheckBox.setChecked(True)
|
||||
self.uiApplyTextToAllItemsCheckBox.hide()
|
||||
|
||||
def _setColor(self, color):
|
||||
self._color = color
|
||||
self.uiColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(color.red(),
|
||||
color.green(),
|
||||
color.blue(),
|
||||
color.alpha()))
|
||||
self.uiPlainTextEdit.setStyleSheet("color: rgba({}, {}, {}, {});".format(color.red(),
|
||||
color.green(),
|
||||
color.blue(),
|
||||
color.alpha()))
|
||||
|
||||
def _setFontSlot(self):
|
||||
"""
|
||||
Slot to select the font.
|
||||
"""
|
||||
|
||||
selected_font, ok = QtGui.QFontDialog.getFont(self.uiPlainTextEdit.font(), self)
|
||||
selected_font, ok = QtWidgets.QFontDialog.getFont(self.uiPlainTextEdit.font(), self)
|
||||
if ok:
|
||||
self.uiPlainTextEdit.setFont(selected_font)
|
||||
|
||||
@@ -67,11 +80,9 @@ class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
Slot to select the color.
|
||||
"""
|
||||
|
||||
color = QtGui.QColorDialog.getColor(self._color, self)
|
||||
color = QtWidgets.QColorDialog.getColor(self._color, self, None, QtWidgets.QColorDialog.ShowAlphaChannel)
|
||||
if color.isValid():
|
||||
self._color = color
|
||||
self.uiColorPushButton.setStyleSheet("background-color: {}".format(self._color.name()))
|
||||
self.uiPlainTextEdit.setStyleSheet("color : {}".format(self._color.name()))
|
||||
self._setColor(color)
|
||||
|
||||
def _applyPreferencesSlot(self):
|
||||
"""
|
||||
@@ -82,7 +93,7 @@ class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
item.setDefaultTextColor(self._color)
|
||||
item.setFont(self.uiPlainTextEdit.font())
|
||||
item.setRotation(self.uiRotationSpinBox.value())
|
||||
if item.editable():
|
||||
if item.editable() and self.uiApplyTextToAllItemsCheckBox.isChecked():
|
||||
item.setPlainText(self.uiPlainTextEdit.toPlainText())
|
||||
|
||||
def done(self, result):
|
||||
@@ -94,4 +105,4 @@ class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
|
||||
if result:
|
||||
self._applyPreferencesSlot()
|
||||
QtGui.QDialog.done(self, result)
|
||||
super().done(result)
|
||||
|
||||
241
gns3/dialogs/vm_wizard.py
Normal file
241
gns3/dialogs/vm_wizard.py
Normal file
@@ -0,0 +1,241 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.servers import Servers
|
||||
|
||||
|
||||
class VMWizard(QtWidgets.QWizard):
|
||||
|
||||
"""
|
||||
Base class for VM wizard.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
|
||||
if sys.platform.startswith("darwin"):
|
||||
# we want to see the cancel button on OSX
|
||||
self.setOptions(QtWidgets.QWizard.NoDefaultButton)
|
||||
|
||||
self._server = Servers.instance().localServer()
|
||||
self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
|
||||
self.uiVMRadioButton.toggled.connect(self._vmToggledSlot)
|
||||
self.uiLocalRadioButton.toggled.connect(self._localToggledSlot)
|
||||
self.uiLoadBalanceCheckBox.toggled.connect(self._loadBalanceToggledSlot)
|
||||
|
||||
# The list of images combo box (Qemu support multiple images)
|
||||
self._images_combo_boxes = set()
|
||||
|
||||
# The list of radio button for existing image or new images
|
||||
self._radio_existing_images_buttons = set()
|
||||
|
||||
def refreshImageStepsButtons(self):
|
||||
"""
|
||||
When changing the server type (remote or local)
|
||||
Refresh all the image selectors
|
||||
"""
|
||||
for radio_button in self._radio_existing_images_buttons:
|
||||
radio_button.setChecked(radio_button.isChecked())
|
||||
|
||||
def _vmToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the VM radio button is toggled.
|
||||
|
||||
:param checked: either the button is checked or not
|
||||
"""
|
||||
if checked:
|
||||
self.uiRemoteServersGroupBox.setEnabled(False)
|
||||
self.uiRemoteServersGroupBox.hide()
|
||||
self.refreshImageStepsButtons()
|
||||
|
||||
def _remoteServerToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the remote server radio button is toggled.
|
||||
|
||||
:param checked: either the button is checked or not
|
||||
"""
|
||||
|
||||
if checked:
|
||||
self.uiRemoteServersGroupBox.setEnabled(True)
|
||||
self.uiRemoteServersGroupBox.show()
|
||||
self.refreshImageStepsButtons()
|
||||
|
||||
def _localToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the local server radio button is toggled.
|
||||
|
||||
:param checked: either the button is checked or not
|
||||
"""
|
||||
if checked:
|
||||
self.uiRemoteServersGroupBox.setEnabled(False)
|
||||
self.uiRemoteServersGroupBox.hide()
|
||||
self.refreshImageStepsButtons()
|
||||
|
||||
def setStartId(self, index):
|
||||
"""
|
||||
Which page should we use when starting the Wizard
|
||||
"""
|
||||
super().setStartId(index)
|
||||
# If we skip the initial page (choosing a server)
|
||||
# we check the settings
|
||||
if index != 0:
|
||||
self.uiLocalRadioButton.setChecked(True)
|
||||
|
||||
def initializePage(self, page_id):
|
||||
|
||||
if self.page(page_id) == self.uiServerWizardPage:
|
||||
self.uiRemoteServersComboBox.clear()
|
||||
for server in Servers.instance().remoteServers().values():
|
||||
self.uiRemoteServersComboBox.addItem(server.url(), server)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
Validates the server.
|
||||
"""
|
||||
|
||||
if self.currentPage() == self.uiServerWizardPage:
|
||||
if self.uiRemoteRadioButton.isChecked():
|
||||
if not Servers.instance().remoteServers():
|
||||
QtWidgets.QMessageBox.critical(self, "Remote server", "There is no remote server registered in your preferences")
|
||||
return False
|
||||
self._server = self.uiRemoteServersComboBox.itemData(self.uiRemoteServersComboBox.currentIndex())
|
||||
elif self.uiVMRadioButton.isChecked():
|
||||
gns3_vm_server = Servers.instance().vmServer()
|
||||
if gns3_vm_server is None:
|
||||
QtWidgets.QMessageBox.critical(self, "GNS3 VM", "The GNS3 VM is not running")
|
||||
return False
|
||||
self._server = gns3_vm_server
|
||||
else:
|
||||
self._server = Servers.instance().localServer()
|
||||
return True
|
||||
|
||||
def _loadBalanceToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the load balance checkbox is toggled.
|
||||
|
||||
:param checked: either the box is checked or not
|
||||
"""
|
||||
|
||||
if checked:
|
||||
self.uiRemoteServersComboBox.setEnabled(False)
|
||||
else:
|
||||
self.uiRemoteServersComboBox.setEnabled(True)
|
||||
|
||||
def addImageSelector(self, radio_button, combo_box, line_edit, browser, image_selector, create_button=None, create_image_wizard=None):
|
||||
"""
|
||||
Add a remote image selector
|
||||
|
||||
:param radio_button: Radio button which toggle display of the listbox
|
||||
:param combo_box: The image choice combo box
|
||||
:param line_edit: The edit for the image
|
||||
:param browser: file upload browser button
|
||||
:param image_selector: function which display an image selector and return path
|
||||
:param create_button: Image create button None if you don't need one
|
||||
:param create_image_wizard: Wizard Class for creating a new image
|
||||
"""
|
||||
|
||||
combo_box.currentIndexChanged.connect(lambda index: self._imageListIndexChangedSlot(index, combo_box, line_edit))
|
||||
self._images_combo_boxes.add(combo_box)
|
||||
|
||||
browser.clicked.connect(lambda: self._imageBrowserSlot(line_edit, image_selector))
|
||||
|
||||
if create_button:
|
||||
assert create_image_wizard is not None
|
||||
create_button.clicked.connect(lambda: self._imageCreateSlot(line_edit, create_image_wizard))
|
||||
|
||||
self._existingImageToggledSlot(True, combo_box, line_edit, browser, create_button)
|
||||
radio_button.toggled.connect(lambda checked: self._existingImageToggledSlot(checked, combo_box, line_edit, browser, create_button))
|
||||
self._radio_existing_images_buttons.add(radio_button)
|
||||
|
||||
def _imageCreateSlot(self, line_edit, create_image_wizard):
|
||||
create_dialog = create_image_wizard(self, self.uiNameLineEdit.text())
|
||||
if QtWidgets.QDialog.Accepted == create_dialog.exec_():
|
||||
line_edit.setText(create_dialog.uiLocationLineEdit.text())
|
||||
|
||||
def _imageBrowserSlot(self, line_edit, image_selector):
|
||||
"""
|
||||
Slot to open a file browser and select an image.
|
||||
"""
|
||||
|
||||
server = Servers.instance().getServerFromString(self.getSettings()["server"])
|
||||
path = image_selector(self, server)
|
||||
if not path:
|
||||
return
|
||||
line_edit.clear()
|
||||
line_edit.setText(path)
|
||||
|
||||
def _imageListIndexChangedSlot(self, index, combo_box, line_edit):
|
||||
"""
|
||||
User select a different image in the combo box
|
||||
"""
|
||||
item = combo_box.itemData(index)
|
||||
if item and item["filename"]:
|
||||
line_edit.setText(item["filename"])
|
||||
else:
|
||||
line_edit.setText("")
|
||||
|
||||
def _existingImageToggledSlot(self, checked, combo_box, line_edit, browser, create_button):
|
||||
"""
|
||||
User select the option of using an existing image
|
||||
"""
|
||||
|
||||
if create_button:
|
||||
create_button.hide()
|
||||
|
||||
if checked:
|
||||
combo_box.show()
|
||||
browser.hide()
|
||||
line_edit.hide()
|
||||
if combo_box.count() > 0:
|
||||
line_edit.setText(combo_box.itemData(combo_box.currentIndex())["filename"])
|
||||
else:
|
||||
combo_box.hide()
|
||||
line_edit.setText("")
|
||||
line_edit.show()
|
||||
browser.show()
|
||||
if create_button and self.uiLocalRadioButton.isChecked():
|
||||
create_button.show()
|
||||
|
||||
def loadImagesList(self, endpoint):
|
||||
"""
|
||||
Fill the list box with available Images"
|
||||
|
||||
:param endpoint: server endpoint with the list of Images
|
||||
"""
|
||||
|
||||
self._server.get(endpoint, self._getImagesFromServerCallback)
|
||||
|
||||
def _getImagesFromServerCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for loadImagesList.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
QtWidgets.QMessageBox.critical(self, "Images", "Error while getting the VMs: {}".format(result["message"]))
|
||||
return
|
||||
|
||||
for combo_box in self._images_combo_boxes:
|
||||
combo_box.clear()
|
||||
for vm in result:
|
||||
combo_box.addItem(vm["filename"], vm)
|
||||
171
gns3/gns3_vm.py
Normal file
171
gns3/gns3_vm.py
Normal file
@@ -0,0 +1,171 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Manages the GNS3 VM.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from .qt import QtNetwork
|
||||
from .servers import Servers
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GNS3VM:
|
||||
|
||||
"""
|
||||
GNS3 VM management class.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self._is_running = False
|
||||
|
||||
def settings(self):
|
||||
"""
|
||||
Returns the GNS3 VM settings.
|
||||
|
||||
:returns: GNS3 VM settings (dict)
|
||||
"""
|
||||
|
||||
return Servers.instance().vmSettings()
|
||||
|
||||
def setSettings(self, settings):
|
||||
"""
|
||||
Set new GNS3 VM settings.
|
||||
|
||||
:param settings: GNS3 VM settings (dict)
|
||||
"""
|
||||
|
||||
Servers.instance().setVMsettings(settings)
|
||||
|
||||
@staticmethod
|
||||
def execute_vmrun(subcommand, args, timeout=60):
|
||||
|
||||
from gns3.modules.vmware import VMware
|
||||
vmware_settings = VMware.instance().settings()
|
||||
vmrun_path = vmware_settings["vmrun_path"]
|
||||
if sys.platform.startswith("darwin"):
|
||||
command = [vmrun_path, "-T", "fusion", subcommand]
|
||||
else:
|
||||
host_type = vmware_settings["host_type"]
|
||||
command = [vmrun_path, "-T", host_type, subcommand]
|
||||
command.extend(args)
|
||||
log.debug("Executing vmrun with command: {}".format(command))
|
||||
output = subprocess.check_output(command, timeout=timeout)
|
||||
return output.decode("utf-8", errors="ignore").strip()
|
||||
|
||||
@staticmethod
|
||||
def execute_vboxmanage(subcommand, args, timeout=60):
|
||||
|
||||
from gns3.modules.virtualbox import VirtualBox
|
||||
virtualbox_settings = VirtualBox.instance().settings()
|
||||
vboxmanage_path = virtualbox_settings["vboxmanage_path"]
|
||||
command = [vboxmanage_path, "--nologo", subcommand]
|
||||
command.extend(args)
|
||||
log.debug("Executing VBoxManage with command: {}".format(command))
|
||||
output = subprocess.check_output(command, timeout=timeout)
|
||||
return output.decode("utf-8", errors="ignore").strip()
|
||||
|
||||
def autoStart(self):
|
||||
"""
|
||||
Automatically start the GNS3 VM at startup.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
vm_settings = Servers.instance().vmSettings()
|
||||
return vm_settings["auto_start"]
|
||||
|
||||
def adjustLocalServerIP(self):
|
||||
"""
|
||||
Adjust the local server IP address to be in the same subnet as the GNS3 VM.
|
||||
|
||||
:returns: the local server IP/host address
|
||||
"""
|
||||
|
||||
servers = Servers.instance()
|
||||
local_server_settings = servers.localServerSettings()
|
||||
if Servers.instance().vmSettings()["adjust_local_server_ip"]:
|
||||
vm_server = servers.vmServer()
|
||||
vm_ip_address = vm_server.host()
|
||||
log.debug("GNS3 VM IP address is {}".format(vm_ip_address))
|
||||
|
||||
for interface in QtNetwork.QNetworkInterface.allInterfaces():
|
||||
for address in interface.addressEntries():
|
||||
ip = address.ip().toString()
|
||||
prefix_length = address.prefixLength()
|
||||
subnet = QtNetwork.QHostAddress.parseSubnet("{}/{}".format(ip, prefix_length))
|
||||
if QtNetwork.QHostAddress(vm_ip_address).isInSubnet(subnet):
|
||||
if local_server_settings["host"] != ip:
|
||||
log.info("Adjust local server IP address to {}".format(ip))
|
||||
servers.setLocalServerSettings({"host": ip})
|
||||
servers.registerLocalServer()
|
||||
servers.save()
|
||||
return ip
|
||||
return local_server_settings["host"]
|
||||
|
||||
def setRunning(self, value):
|
||||
"""
|
||||
Sets either the GNS3 VM is running or not.
|
||||
|
||||
:param value: boolean
|
||||
"""
|
||||
|
||||
self._is_running = value
|
||||
|
||||
def isRunning(self):
|
||||
"""
|
||||
Returns either the GNS3 VM is running or not.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
return self._is_running
|
||||
|
||||
def shutdown(self, force=False):
|
||||
"""
|
||||
Gracefully shutdowns the GNS3 VM.
|
||||
"""
|
||||
|
||||
vm_settings = self.settings()
|
||||
if self._is_running and (vm_settings["auto_stop"] or force):
|
||||
try:
|
||||
if vm_settings["virtualization"] == "VMware":
|
||||
self.execute_vmrun("stop", [vm_settings["vmx_path"], "soft"])
|
||||
elif vm_settings["virtualization"] == "VirtualBox":
|
||||
self.execute_vboxmanage("controlvm", [vm_settings["vmname"], "acpipowerbutton"], timeout=3)
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
except subprocess.TimeoutExpired:
|
||||
log.warning("Could not ACPI shutdown the VM (timeout expired)")
|
||||
|
||||
@staticmethod
|
||||
def instance():
|
||||
"""
|
||||
Singleton to return only on instance of GNS3VM
|
||||
|
||||
:returns: instance of GNS3VM
|
||||
"""
|
||||
|
||||
if not hasattr(GNS3VM, "_instance") or GNS3VM._instance is None:
|
||||
GNS3VM._instance = GNS3VM()
|
||||
return GNS3VM._instance
|
||||
File diff suppressed because it is too large
Load Diff
757
gns3/http_client.py
Normal file
757
gns3/http_client.py
Normal file
@@ -0,0 +1,757 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import json
|
||||
import http
|
||||
import ipaddress
|
||||
import uuid
|
||||
import urllib.request
|
||||
import pathlib
|
||||
import base64
|
||||
from functools import partial
|
||||
|
||||
from .version import __version__, __version_info__
|
||||
from .qt import QtCore, QtNetwork
|
||||
from .network_client import getNetworkUrl
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HttpBadRequest(Exception):
|
||||
|
||||
"""We raise bad request exception for logging them in Sentry"""
|
||||
pass
|
||||
|
||||
|
||||
class HTTPClient(QtCore.QObject):
|
||||
|
||||
"""
|
||||
HTTP client.
|
||||
|
||||
:param settings: Dictionnary with connection information to the server
|
||||
:param network_manager: A QT network manager
|
||||
"""
|
||||
|
||||
_instance_count = 1
|
||||
|
||||
# Callback class used for displaying progress
|
||||
_progress_callback = None
|
||||
|
||||
connected_signal = QtCore.Signal()
|
||||
connection_error_signal = QtCore.Signal(str)
|
||||
|
||||
def __init__(self, settings, network_manager):
|
||||
|
||||
super().__init__()
|
||||
self._version = ""
|
||||
|
||||
self._scheme = settings.get("protocol", "http")
|
||||
self._host = settings["host"]
|
||||
self._http_host = settings["host"]
|
||||
self._port = int(settings["port"])
|
||||
self._http_port = int(settings["port"])
|
||||
self._user = settings.get("user", None)
|
||||
self._password = settings.get("password", None)
|
||||
self._connected = False
|
||||
self._local = True
|
||||
self._cloud = False
|
||||
self._gns3_vm = False
|
||||
self._ram_limit = settings.get("ram_limit", 0)
|
||||
self._allocated_ram = 0
|
||||
self._accept_insecure_certificate = settings.get("accept_insecure_certificate", None)
|
||||
|
||||
self._network_manager = network_manager
|
||||
|
||||
# A buffer used by progress download
|
||||
self._buffer = {}
|
||||
|
||||
# create an unique ID
|
||||
self._id = HTTPClient._instance_count
|
||||
HTTPClient._instance_count += 1
|
||||
|
||||
def getTunnel(self, port):
|
||||
"""
|
||||
Get a tunnel to the remote port.
|
||||
For HTTP standard client it's the same port. For SSH it will create a new tunnel.
|
||||
|
||||
:param port: Remote port
|
||||
:returns: Tuple host, port to connect
|
||||
"""
|
||||
return self._host, port
|
||||
|
||||
def releaseTunnel(self, port):
|
||||
"""
|
||||
Release a tunnel to the remote port.
|
||||
For HTTP standard client it's do nothing
|
||||
|
||||
:param port: Allocated remote port
|
||||
"""
|
||||
pass
|
||||
|
||||
def settings(self):
|
||||
"""
|
||||
Return a dictionnary with server settings
|
||||
"""
|
||||
settings = {"protocol": self.protocol(),
|
||||
"ram_limit": self.RAMLimit(),
|
||||
"host": self.host(),
|
||||
"port": self.port(),
|
||||
"user": self.user(),
|
||||
"password": self._password}
|
||||
if self.protocol() == "https":
|
||||
settings["accept_insecure_certificate"] = self.acceptInsecureCertificate()
|
||||
return settings
|
||||
|
||||
def acceptInsecureCertificate(self, certificate=None):
|
||||
"""
|
||||
Does the server accept this insecure SSL certificate digest
|
||||
|
||||
:param: Certificate digest
|
||||
"""
|
||||
return self._accept_insecure_certificate
|
||||
|
||||
def setAcceptInsecureCertificate(self, certificate):
|
||||
"""
|
||||
Does the server accept this insecure SSL certificate digest
|
||||
|
||||
:param: Certificate digest
|
||||
"""
|
||||
self._accept_insecure_certificate = certificate
|
||||
|
||||
def host(self):
|
||||
"""
|
||||
Host display to user
|
||||
"""
|
||||
return self._host
|
||||
|
||||
def setHost(self, host):
|
||||
self._host = host
|
||||
self._http_host = host
|
||||
|
||||
def port(self):
|
||||
"""
|
||||
Port display to user
|
||||
"""
|
||||
return self._port
|
||||
|
||||
def setPort(self, port):
|
||||
self._port = port
|
||||
self._http_port = port
|
||||
|
||||
def protocol(self):
|
||||
"""
|
||||
Transport protocol
|
||||
"""
|
||||
return self._scheme
|
||||
|
||||
def user(self):
|
||||
"""
|
||||
User login display to GNS3 user
|
||||
"""
|
||||
return self._user
|
||||
|
||||
def setUser(self, user):
|
||||
self._user = user
|
||||
|
||||
def setPassword(self, password):
|
||||
self._password = password
|
||||
|
||||
def notify_progress_start_query(self, query_id, progress_text, response):
|
||||
"""
|
||||
Called when a query start
|
||||
"""
|
||||
if HTTPClient._progress_callback:
|
||||
if progress_text:
|
||||
HTTPClient._progress_callback.add_query_signal.emit(query_id, progress_text, response)
|
||||
else:
|
||||
if self._local:
|
||||
HTTPClient._progress_callback.add_query_signal.emit(query_id, "Waiting for local GNS3 server", response)
|
||||
else:
|
||||
HTTPClient._progress_callback.add_query_signal.emit(query_id, "Waiting for {}".format(self.url()), response)
|
||||
|
||||
def notify_progress_end_query(cls, query_id):
|
||||
"""
|
||||
Called when a query is over
|
||||
"""
|
||||
|
||||
if HTTPClient._progress_callback:
|
||||
HTTPClient._progress_callback.remove_query_signal.emit(query_id)
|
||||
|
||||
def notify_progress_upload(self, query_id, sent, total):
|
||||
"""
|
||||
Called when a query upload progress
|
||||
"""
|
||||
if HTTPClient._progress_callback:
|
||||
HTTPClient._progress_callback.progress(query_id, sent, total)
|
||||
|
||||
def notify_progress_download(self, query_id, sent, total):
|
||||
"""
|
||||
Called when a query download progress
|
||||
"""
|
||||
if HTTPClient._progress_callback:
|
||||
HTTPClient._progress_callback.progress(query_id, sent, total)
|
||||
|
||||
@classmethod
|
||||
def setProgressCallback(cls, progress_callback):
|
||||
"""
|
||||
:param progress_callback: A progress callback instance
|
||||
"""
|
||||
|
||||
cls._progress_callback = progress_callback
|
||||
|
||||
@staticmethod
|
||||
def reset():
|
||||
"""Reset HTTP client internal variables"""
|
||||
|
||||
HTTPClient._instance_count = 0
|
||||
|
||||
def url(self):
|
||||
"""Returns current server url"""
|
||||
|
||||
return getNetworkUrl(self.protocol(), self.host(), self.port(), self.user(), self.settings())
|
||||
|
||||
def id(self):
|
||||
"""
|
||||
Returns this HTTP Client identifier.
|
||||
:returns: HTTP client identifier (string)
|
||||
"""
|
||||
|
||||
return self._id
|
||||
|
||||
def setLocal(self, value):
|
||||
"""
|
||||
Sets either this is a connection to a local server or not.
|
||||
:param value: boolean
|
||||
"""
|
||||
|
||||
self._local = value
|
||||
|
||||
def isLocal(self):
|
||||
"""
|
||||
Returns either this is a connection to a local server or not.
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
return self._local
|
||||
|
||||
def setGNS3VM(self, value):
|
||||
"""
|
||||
Sets either this is a connection to the GNS3 VM or not.
|
||||
|
||||
:param value: boolean
|
||||
"""
|
||||
|
||||
self._gns3_vm = value
|
||||
|
||||
def isGNS3VM(self):
|
||||
"""
|
||||
Returns either this is a connection to the GNS3 VM or not.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
return self._gns3_vm
|
||||
|
||||
def connected(self):
|
||||
"""
|
||||
Returns if the client is connected.
|
||||
:returns: True or False
|
||||
"""
|
||||
|
||||
return self._connected
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Closes the connection with the server.
|
||||
"""
|
||||
log.info("Connection to %s closed", self.url())
|
||||
self._connected = False
|
||||
|
||||
def isLocalServerRunning(self):
|
||||
"""
|
||||
Synchronous check if a server is already running on this host.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
status, json_data = self.getSynchronous("version", timeout=2)
|
||||
if json_data is None or status != 200:
|
||||
return False
|
||||
else:
|
||||
version = json_data.get("version")
|
||||
local_server = json_data.get("local", False)
|
||||
if version != __version__:
|
||||
log.debug("Client version {} differs with server version {}".format(__version__, version))
|
||||
return False
|
||||
if not local_server:
|
||||
log.debug("Running server is not a GNS3 local server (not started with --local)")
|
||||
return False
|
||||
return True
|
||||
|
||||
def getSynchronous(self, endpoint, timeout=2):
|
||||
"""
|
||||
Synchronous check if a server is running
|
||||
|
||||
:returns: Tuple (Status code, json of anwser). Status 0 is a non HTTP error
|
||||
"""
|
||||
try:
|
||||
url = "{protocol}://{host}:{port}/v1/{endpoint}".format(protocol=self._scheme, host=self._http_host, port=self._http_port, endpoint=endpoint)
|
||||
|
||||
log.debug("Synchronous get %s with user %s", url, self._user)
|
||||
if self._user is not None and len(self._user) > 0:
|
||||
auth_handler = urllib.request.HTTPBasicAuthHandler()
|
||||
auth_handler.add_password(realm="GNS3 server",
|
||||
uri=url,
|
||||
user=self._user,
|
||||
passwd=self._password)
|
||||
opener = urllib.request.build_opener(auth_handler)
|
||||
urllib.request.install_opener(opener)
|
||||
|
||||
response = urllib.request.urlopen(url, timeout=timeout)
|
||||
content_type = response.getheader("CONTENT-TYPE")
|
||||
if response.status == 200:
|
||||
if content_type == "application/json":
|
||||
content = response.read()
|
||||
json_data = json.loads(content.decode("utf-8"))
|
||||
return response.status, json_data
|
||||
else:
|
||||
return response.status, None
|
||||
except urllib.error.HTTPError as e:
|
||||
log.debug("Error during get on {}:{}: {}".format(self.host(), self.port(), e))
|
||||
return e.code, None
|
||||
except (OSError, http.client.BadStatusLine, ValueError) as e:
|
||||
log.debug("Error during get on {}:{}: {}".format(self.host(), self.port(), e))
|
||||
return 0, None
|
||||
|
||||
def get(self, path, callback, **kwargs):
|
||||
"""
|
||||
HTTP GET on the remote server
|
||||
|
||||
:param path: Remote path
|
||||
:param callback: callback method to call when the server replies
|
||||
|
||||
Full arg list in createHTTPQuery
|
||||
"""
|
||||
|
||||
self.createHTTPQuery("GET", path, callback, **kwargs)
|
||||
|
||||
def put(self, path, callback, **kwargs):
|
||||
"""
|
||||
HTTP PUT on the remote server
|
||||
|
||||
:param path: Remote path
|
||||
:param callback: callback method to call when the server replies
|
||||
|
||||
Full arg list in createHTTPQuery
|
||||
"""
|
||||
|
||||
self.createHTTPQuery("PUT", path, callback, **kwargs)
|
||||
|
||||
def post(self, path, callback, **kwargs):
|
||||
"""
|
||||
HTTP POST on the remote server
|
||||
|
||||
:param path: Remote path
|
||||
:param callback: callback method to call when the server replies
|
||||
|
||||
Full arg list in createHTTPQuery
|
||||
"""
|
||||
|
||||
self.createHTTPQuery("POST", path, callback, **kwargs)
|
||||
|
||||
def delete(self, path, callback, **kwargs):
|
||||
"""
|
||||
HTTP DELETE on the remote server
|
||||
|
||||
:param path: Remote path
|
||||
:param callback: callback method to call when the server replies
|
||||
|
||||
Full arg list in createHTTPQuery
|
||||
"""
|
||||
|
||||
self.createHTTPQuery("DELETE", path, callback, **kwargs)
|
||||
|
||||
def _request(self, url):
|
||||
"""
|
||||
Get a QNetworkRequest object. You can mock this
|
||||
if you want low level mocking.
|
||||
|
||||
:param url: Url of remote ressource (QtCore.QUrl)
|
||||
:returns: QT Network request (QtNetwork.QNetworkRequest)
|
||||
"""
|
||||
|
||||
return QtNetwork.QNetworkRequest(url)
|
||||
|
||||
# FIXME: connect is a method in parent class (QObject)
|
||||
def connect(self, query, callback):
|
||||
"""
|
||||
Initialize the connection
|
||||
|
||||
:param query: The query to execute when all network stack is ready
|
||||
:param callback: User callback when connection is finish
|
||||
"""
|
||||
self.executeHTTPQuery("GET", "/version", query, {})
|
||||
|
||||
def createHTTPQuery(self, method, path, callback, body={}, context={}, downloadProgressCallback=None, showProgress=True, ignoreErrors=False, progressText=None):
|
||||
"""
|
||||
Call the remote server, if not connected, check connection before
|
||||
|
||||
:param method: HTTP method
|
||||
:param path: Remote path
|
||||
:param body: params to send (dictionary or pathlib.Path)
|
||||
:param callback: callback method to call when the server replies
|
||||
:param context: Pass a context to the response callback
|
||||
:param downloadProgressCallback: Callback called when received something, it can be an incomplete response
|
||||
:param showProgress: Display progress to the user
|
||||
:params progressText: Text display to user in the progress dialog. None for auto generated
|
||||
:param ignoreErrors: Ignore connection error (usefull to not closing a connection when notification feed is broken)
|
||||
:returns: QNetworkReply
|
||||
"""
|
||||
|
||||
if self._connected:
|
||||
return self.executeHTTPQuery(method, path, callback, body, context, downloadProgressCallback=downloadProgressCallback, showProgress=showProgress, ignoreErrors=ignoreErrors, progressText=progressText)
|
||||
else:
|
||||
log.info("Connection to {}".format(self.url()))
|
||||
query = partial(self._callbackConnect, method, path, callback, body, context, downloadProgressCallback=downloadProgressCallback, showProgress=showProgress, ignoreErrors=ignoreErrors, progressText=progressText)
|
||||
self.connect(query, callback)
|
||||
|
||||
def _connectionError(self, callback, msg=""):
|
||||
"""
|
||||
Return an error to user if connection failed
|
||||
|
||||
:param callback: User callback
|
||||
:param msg: An optional additional message for the callback
|
||||
"""
|
||||
|
||||
if len(msg) > 0:
|
||||
msg = "Can't connect to server {}: {}".format(self.url(), msg)
|
||||
else:
|
||||
msg = "Can't connect to server {}".format(self.url())
|
||||
log.error(msg)
|
||||
if callback is not None:
|
||||
callback({"message": msg}, error=True, server=self)
|
||||
|
||||
def _callbackConnect(self, method, path, callback, body, original_context, params, error=False, server=None, **kwargs):
|
||||
"""
|
||||
Callback after /version response. Continue execution of query
|
||||
|
||||
:param method: HTTP method
|
||||
:param path: Remote path
|
||||
:param body: params to send (dictionary or pathlib.Path)
|
||||
:param original_context: Original context
|
||||
:param callback: callback method to call when the server replies
|
||||
"""
|
||||
|
||||
if error is not False:
|
||||
self._connectionError(callback)
|
||||
return
|
||||
|
||||
if "version" not in params or "local" not in params:
|
||||
msg = "The remote server {} is not a GNS3 server".format(self.url())
|
||||
log.error(msg)
|
||||
if callback is not None:
|
||||
callback({"message": msg}, error=True, server=self)
|
||||
return
|
||||
|
||||
if params["version"] != __version__:
|
||||
msg = "Client version {} differs with server version {}".format(__version__, params["version"])
|
||||
log.error(msg)
|
||||
# Official release
|
||||
if __version_info__[3] == 0:
|
||||
if callback is not None:
|
||||
callback({"message": msg}, error=True, server=self)
|
||||
return
|
||||
else:
|
||||
print(msg)
|
||||
print("WARNING: Use a different client and server version can create bugs. Use it at your own risk.")
|
||||
|
||||
if params["local"] != self.isLocal():
|
||||
if self.isLocal():
|
||||
msg = "Running server is not a GNS3 local server (not started with --local)"
|
||||
else:
|
||||
msg = "Remote running server is started with --local. It is forbidden for security reasons"
|
||||
log.error(msg)
|
||||
if callback is not None:
|
||||
callback({"message": msg}, error=True, server=self)
|
||||
return
|
||||
|
||||
self._connected = True
|
||||
kwargs["context"] = original_context
|
||||
self.executeHTTPQuery(method, path, callback, body, **kwargs)
|
||||
self._version = params["version"]
|
||||
|
||||
def _addBodyToRequest(self, body, request):
|
||||
"""
|
||||
Add the require headers for sending the body.
|
||||
It detect the type of body for sending the corresponding headers
|
||||
and methods.
|
||||
|
||||
:param body: The body
|
||||
:returns: The body compatible with Qt
|
||||
"""
|
||||
|
||||
if body is None:
|
||||
return None
|
||||
|
||||
if isinstance(body, dict):
|
||||
body = json.dumps(body)
|
||||
request.setRawHeader("Content-Type", "application/json")
|
||||
request.setRawHeader("Content-Length", str(len(body)))
|
||||
data = QtCore.QByteArray(body)
|
||||
body = QtCore.QBuffer(self)
|
||||
body.setData(data)
|
||||
body.open(QtCore.QIODevice.ReadOnly)
|
||||
return body
|
||||
elif isinstance(body, pathlib.Path):
|
||||
body = QtCore.QFile(str(body), self)
|
||||
body.open(QtCore.QFile.ReadOnly)
|
||||
request.setRawHeader("Content-Type", "application/octet-stream")
|
||||
# QT is smart and will compute the Content-Lenght for us
|
||||
return body
|
||||
else:
|
||||
return None
|
||||
|
||||
def addAuth(self, request):
|
||||
"""
|
||||
If require add basic auth header
|
||||
"""
|
||||
if self._user:
|
||||
auth_string = "{}:{}".format(self._user, self._password)
|
||||
auth_string = base64.b64encode(auth_string.encode("utf-8"))
|
||||
auth_string = "Basic {}".format(auth_string.decode())
|
||||
request.setRawHeader("Authorization", auth_string)
|
||||
return request
|
||||
|
||||
def executeHTTPQuery(self, method, path, callback, body, context={}, downloadProgressCallback=None, showProgress=True, ignoreErrors=False, progressText=None):
|
||||
"""
|
||||
Call the remote server
|
||||
|
||||
:param method: HTTP method
|
||||
:param path: Remote path
|
||||
:param body: params to send (dictionary)
|
||||
:param callback: callback method to call when the server replies
|
||||
:param context: Pass a context to the response callback
|
||||
:param downloadProgressCallback: Callback called when received something, it can be an incomplete response
|
||||
:param showProgress: Display progress to the user
|
||||
:param progressText: Text display to user in progress dialog. None for auto generated
|
||||
:param ignoreErrors: Ignore connection error (usefull to not closing a connection when notification feed is broken)
|
||||
:returns: QNetworkReply
|
||||
"""
|
||||
|
||||
try:
|
||||
ip = self._http_host.rsplit('%', 1)[0]
|
||||
ipaddress.IPv6Address(ip) # remove any scope ID
|
||||
# this is an IPv6 address, we must surround it with brackets to be used with QUrl.
|
||||
host = "[{}]".format(ip)
|
||||
except ipaddress.AddressValueError:
|
||||
host = self._http_host
|
||||
|
||||
log.debug("{method} {protocol}://{host}:{port}/v1{path} {body}".format(method=method, protocol=self._scheme, host=host, port=self._http_port, path=path, body=body))
|
||||
url = QtCore.QUrl("{protocol}://{host}:{port}/v1{path}".format(protocol=self._scheme, host=host, port=self._http_port, path=path))
|
||||
request = self._request(url)
|
||||
|
||||
request = self.addAuth(request)
|
||||
|
||||
request.setRawHeader("User-Agent", "GNS3 QT Client v{version}".format(version=__version__))
|
||||
|
||||
# By default QT doesn't support GET with body even if it's in the RFC that's why we need to use sendCustomRequest
|
||||
body = self._addBodyToRequest(body, request)
|
||||
|
||||
response = self._network_manager.sendCustomRequest(request, method, body)
|
||||
|
||||
import copy
|
||||
context = copy.copy(context)
|
||||
query_id = str(uuid.uuid4())
|
||||
context["query_id"] = query_id
|
||||
if showProgress:
|
||||
self.notify_progress_start_query(context["query_id"], progressText, response)
|
||||
response.uploadProgress.connect(partial(self.notify_progress_upload, query_id))
|
||||
response.downloadProgress.connect(partial(self.notify_progress_download, query_id))
|
||||
|
||||
response.finished.connect(partial(self._processResponse, response, callback, context, body, ignoreErrors))
|
||||
if downloadProgressCallback is not None:
|
||||
response.downloadProgress.connect(partial(self._processDownloadProgress, response, downloadProgressCallback, context))
|
||||
return response
|
||||
|
||||
def _processDownloadProgress(self, response, callback, context):
|
||||
"""
|
||||
Process a packet receive on the notification feed.
|
||||
The feed can contains partial JSON. If we found a
|
||||
part of a JSON we keep it for the next packet
|
||||
"""
|
||||
|
||||
if response.error() == QtNetwork.QNetworkReply.NoError:
|
||||
error_code = response.error()
|
||||
|
||||
if error_code >= 300:
|
||||
return
|
||||
|
||||
content = bytes(response.readAll())
|
||||
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
|
||||
if content_type == "application/json":
|
||||
content = content.decode("utf-8")
|
||||
if context["query_id"] in self._buffer:
|
||||
content = self._buffer[context["query_id"]] + content
|
||||
try:
|
||||
while True:
|
||||
content = content.lstrip(" \r\n\t")
|
||||
answer, index = json.JSONDecoder().raw_decode(content)
|
||||
callback(answer, server=self, context=context)
|
||||
content = content[index:]
|
||||
except ValueError: # Partial JSON
|
||||
self._buffer[context["query_id"]] = content
|
||||
else:
|
||||
callback(content, server=self, context=context)
|
||||
|
||||
if HTTPClient._progress_callback and HTTPClient._progress_callback.progress_dialog():
|
||||
request_canceled = partial(self._requestCanceled, response, context)
|
||||
HTTPClient._progress_callback.progress_dialog().canceled.connect(request_canceled)
|
||||
|
||||
def _requestCanceled(self, response, context):
|
||||
|
||||
if response.isRunning():
|
||||
response.abort()
|
||||
if "query_id" in context:
|
||||
self.notify_progress_end_query(context["query_id"])
|
||||
|
||||
def _processResponse(self, response, callback, context, request_body, ignore_errors):
|
||||
|
||||
if request_body is not None:
|
||||
request_body.close()
|
||||
|
||||
status = None
|
||||
body = None
|
||||
|
||||
if "query_id" in context:
|
||||
self.notify_progress_end_query(context["query_id"])
|
||||
|
||||
if response.error() != QtNetwork.QNetworkReply.NoError:
|
||||
error_code = response.error()
|
||||
error_message = response.errorString()
|
||||
|
||||
if not ignore_errors:
|
||||
log.info("Response error: %s (error: %d)", error_message, error_code)
|
||||
|
||||
if error_code < 200:
|
||||
if not ignore_errors:
|
||||
self.close()
|
||||
if callback is not None:
|
||||
callback({"message": error_message}, error=True, server=self, context=context)
|
||||
return
|
||||
else:
|
||||
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
|
||||
if status == 401:
|
||||
print(error_message)
|
||||
|
||||
try:
|
||||
body = bytes(response.readAll()).decode("utf-8").strip("\0")
|
||||
# Some time antivirus intercept our query and reply with garbage content
|
||||
except UnicodeError:
|
||||
body = None
|
||||
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
|
||||
if callback is not None:
|
||||
if not body or content_type != "application/json":
|
||||
callback({"message": error_message}, error=True, server=self, context=context)
|
||||
else:
|
||||
log.debug(body)
|
||||
callback(json.loads(body), error=True, server=self, context=context)
|
||||
else:
|
||||
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
|
||||
log.debug("Decoding response from {} response {}".format(response.url().toString(), status))
|
||||
try:
|
||||
body = bytes(response.readAll()).decode("utf-8").strip("\0")
|
||||
# Some time anti-virus intercept our query and reply with garbage content
|
||||
except UnicodeDecodeError:
|
||||
body = None
|
||||
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
|
||||
log.debug(body)
|
||||
if body and len(body.strip(" \n\t")) > 0 and content_type == "application/json":
|
||||
params = json.loads(body)
|
||||
else:
|
||||
params = {}
|
||||
if callback is not None:
|
||||
if status >= 400:
|
||||
callback(params, error=True, server=self, context=context)
|
||||
else:
|
||||
callback(params, server=self, context=context)
|
||||
# response.deleteLater()
|
||||
if status == 400:
|
||||
raise HttpBadRequest(body)
|
||||
|
||||
def RAMLimit(self):
|
||||
"""
|
||||
Returns the RAM limit for this server (used for RAM usage load balancing).
|
||||
|
||||
:returns: RAM limit (integer)
|
||||
"""
|
||||
|
||||
return self._ram_limit
|
||||
|
||||
def allocatedRAM(self):
|
||||
"""
|
||||
Amount of allocated RAM on this server (used for RAM usage load balancing).
|
||||
|
||||
:returns: allocated RAM (integer)
|
||||
"""
|
||||
|
||||
return self._allocated_ram
|
||||
|
||||
def increaseAllocatedRAM(self, ram):
|
||||
"""
|
||||
Increase the amount of allocated RAM on this server (used for RAM usage load balancing).
|
||||
|
||||
:param ram: amount of RAM (integer)
|
||||
"""
|
||||
|
||||
log.info("RAM usage on {} has increased by {} MB (total load is now {} MB)".format(self.url(), ram, self._allocated_ram + ram))
|
||||
self._allocated_ram += ram
|
||||
|
||||
def decreaseAllocatedRAM(self, ram):
|
||||
"""
|
||||
Decrease the amount of allocated RAM on this server (used for RAM usage load balancing).
|
||||
|
||||
:param ram: amount of RAM (integer)
|
||||
"""
|
||||
|
||||
log.info("RAM usage on {} has decreased by {} MB (total load is now {} MB)".format(self.url(), ram, self._allocated_ram - ram))
|
||||
self._allocated_ram -= ram
|
||||
if self._allocated_ram < 0:
|
||||
self._allocated_ram = 0
|
||||
|
||||
def dump(self):
|
||||
"""
|
||||
Returns a representation of this server.
|
||||
:returns: dictionary
|
||||
"""
|
||||
|
||||
server = self.settings()
|
||||
server["id"] = self._id
|
||||
server["local"] = self._local
|
||||
server["vm"] = self._gns3_vm
|
||||
#server["cloud"] = self._cloud
|
||||
if "user" in server and self._local:
|
||||
del server["user"]
|
||||
if "password" in server:
|
||||
del server["password"]
|
||||
if server["protocol"] == "https":
|
||||
server["accept_insecure_certificate"] = self._accept_insecure_certificate
|
||||
return server
|
||||
|
||||
def isCloud(self):
|
||||
return False
|
||||
153
gns3/image_manager.py
Normal file
153
gns3/image_manager.py
Normal file
@@ -0,0 +1,153 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
from gns3.servers import Servers
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.utils.file_copy_worker import FileCopyWorker
|
||||
from gns3.utils.progress_dialog import ProgressDialog
|
||||
|
||||
|
||||
class ImageManager:
|
||||
|
||||
def __init__(self):
|
||||
# Remember if we already ask the user about this image for this server
|
||||
self._asked_for_this_image = {}
|
||||
|
||||
def askCopyUploadImage(self, parent, path, server, vm_type):
|
||||
"""
|
||||
Ask user for copying the image to the default directory or upload
|
||||
it to remote server.
|
||||
|
||||
:param parent: Parent window
|
||||
:param path: File path on computer
|
||||
:param server: The server where the images should be located
|
||||
:param vm_type: Remote upload endpoint
|
||||
:returns path: Final path
|
||||
"""
|
||||
|
||||
if server and not server.isLocal():
|
||||
return self._uploadImageToRemoteServer(path, server, vm_type)
|
||||
else:
|
||||
destination_directory = self.getDirectoryForType(vm_type)
|
||||
if os.path.normpath(os.path.dirname(path)) != destination_directory:
|
||||
# the IOS image is not in the default images directory
|
||||
reply = QtWidgets.QMessageBox.question(parent,
|
||||
'Image',
|
||||
'Would you like to copy {} to the default images directory'.format(os.path.basename(path)),
|
||||
QtWidgets.QMessageBox.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
destination_path = os.path.join(destination_directory, os.path.basename(path))
|
||||
worker = FileCopyWorker(path, destination_path)
|
||||
progress_dialog = ProgressDialog(worker, 'Image', 'Copying {}'.format(os.path.basename(path)), 'Cancel', busy=True, parent=parent)
|
||||
progress_dialog.show()
|
||||
progress_dialog.exec_()
|
||||
errors = progress_dialog.errors()
|
||||
if errors:
|
||||
QtWidgets.QMessageBox.critical(parent, 'Image', '{}'.format(''.join(errors)))
|
||||
else:
|
||||
path = destination_path
|
||||
return path
|
||||
|
||||
def _uploadImageToRemoteServer(self, path, server, vm_type):
|
||||
"""
|
||||
Upload image to remote server
|
||||
|
||||
:param path: File path on computer
|
||||
:param server: The server where the images should be located
|
||||
:param vm_type: Image vm_type
|
||||
:returns path: Final path
|
||||
"""
|
||||
|
||||
if vm_type == 'QEMU':
|
||||
upload_endpoint = '/qemu/vms'
|
||||
elif vm_type == 'IOU':
|
||||
upload_endpoint = '/iou/vms'
|
||||
elif vm_type == 'DYNAMIPS':
|
||||
upload_endpoint = '/dynamips/vms'
|
||||
else:
|
||||
raise Exception('Invalid image vm_type')
|
||||
|
||||
filename = os.path.basename(path)
|
||||
server.post('{}/{}'.format(upload_endpoint, filename), None, body=pathlib.Path(path))
|
||||
return filename
|
||||
|
||||
def addMissingImage(self, filename, server, vm_type):
|
||||
"""
|
||||
Add a missing image to the queue of images require to be upload on remote server
|
||||
:param filename: Filename of the image
|
||||
:param server: Server where image should be uploaded
|
||||
:param vm_type: Type of the image
|
||||
"""
|
||||
|
||||
if self._asked_for_this_image.setdefault(server.id(), {}).setdefault(filename, False):
|
||||
return
|
||||
self._asked_for_this_image[server.id()][filename] = True
|
||||
|
||||
if server.isLocal():
|
||||
return
|
||||
path = os.path.join(self.getDirectoryForType(vm_type), filename)
|
||||
if os.path.exists(path):
|
||||
if self._askForUploadMissingImage(filename, server):
|
||||
self._uploadImageToRemoteServer(path, server, vm_type)
|
||||
del self._asked_for_this_image[server.id()][filename]
|
||||
|
||||
def _askForUploadMissingImage(self, filename, server):
|
||||
from gns3.main_window import MainWindow
|
||||
parent = MainWindow.instance()
|
||||
reply = QtWidgets.QMessageBox.warning(parent,
|
||||
'Image',
|
||||
'{} is missing on server {} but exist on your computer. Do you want to upload it?'.format(filename, server.url()),
|
||||
QtWidgets.QMessageBox.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
return True
|
||||
return False
|
||||
|
||||
def getDirectory(self):
|
||||
"""
|
||||
Returns the images directory path.
|
||||
|
||||
:returns: path to the default images directory
|
||||
"""
|
||||
|
||||
return Servers.instance().localServerSettings()['images_path']
|
||||
|
||||
def getDirectoryForType(self, vm_type):
|
||||
"""
|
||||
Return the path of local directory of the images
|
||||
of a specific vm_type
|
||||
"""
|
||||
if vm_type == 'DYNAMIPS':
|
||||
return os.path.join(self.getDirectory(), 'IOS')
|
||||
else:
|
||||
return os.path.join(self.getDirectory(), vm_type)
|
||||
|
||||
@staticmethod
|
||||
def instance():
|
||||
"""
|
||||
Singleton to return only on instance of ImageManager.
|
||||
|
||||
:returns: instance of ImageManager
|
||||
"""
|
||||
|
||||
if not hasattr(ImageManager, '_instance') or ImageManager._instance is None:
|
||||
ImageManager._instance = ImageManager()
|
||||
return ImageManager._instance
|
||||
@@ -19,19 +19,20 @@
|
||||
Graphical representation of an ellipse on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from .shape_item import ShapeItem
|
||||
|
||||
|
||||
class EllipseItem(ShapeItem, QtGui.QGraphicsEllipseItem):
|
||||
class EllipseItem(QtWidgets.QGraphicsEllipseItem, ShapeItem):
|
||||
|
||||
"""
|
||||
Class to draw an ellipse on the scene.
|
||||
"""
|
||||
|
||||
def __init__(self, pos=None, width=200, height=200):
|
||||
|
||||
QtGui.QGraphicsEllipseItem.__init__(self, 0, 0, width, height)
|
||||
ShapeItem.__init__(self)
|
||||
super().__init__()
|
||||
self.setRect(0, 0, width, height)
|
||||
pen = QtGui.QPen(QtCore.Qt.black, 2, QtCore.Qt.DashLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
|
||||
self.setPen(pen)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 255)) # default color is white and not transparent
|
||||
@@ -57,7 +58,7 @@ class EllipseItem(ShapeItem, QtGui.QGraphicsEllipseItem):
|
||||
:param widget: QWidget instance
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsEllipseItem.paint(self, painter, option, widget)
|
||||
super().paint(painter, option, widget)
|
||||
self.drawLayerInfo(painter)
|
||||
|
||||
def duplicate(self):
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
Graphical representation of an Ethernet link for QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from .link_item import LinkItem
|
||||
from .note_item import NoteItem
|
||||
from ..ports.port import Port
|
||||
|
||||
|
||||
class EthernetLinkItem(LinkItem):
|
||||
|
||||
"""
|
||||
Ethernet link for the scene.
|
||||
|
||||
@@ -40,7 +41,7 @@ class EthernetLinkItem(LinkItem):
|
||||
|
||||
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
|
||||
|
||||
LinkItem.__init__(self, source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
|
||||
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
|
||||
self._source_collision_offset = 0.0
|
||||
self._destination_collision_offset = 0.0
|
||||
|
||||
@@ -74,7 +75,7 @@ class EthernetLinkItem(LinkItem):
|
||||
:returns: QPainterPath instance
|
||||
"""
|
||||
|
||||
path = QtGui.QGraphicsPathItem.shape(self)
|
||||
path = QtWidgets.QGraphicsPathItem.shape(self)
|
||||
offset = self._point_size / 2
|
||||
if not self._adding_flag:
|
||||
if self.length:
|
||||
@@ -105,7 +106,7 @@ class EthernetLinkItem(LinkItem):
|
||||
:param widget: QWidget instance.
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsPathItem.paint(self, painter, option, widget)
|
||||
QtWidgets.QGraphicsPathItem.paint(self, painter, option, widget)
|
||||
if not self._adding_flag and self._settings["draw_link_status_points"]:
|
||||
|
||||
# points disappears if nodes are too close to each others.
|
||||
|
||||
@@ -19,21 +19,20 @@
|
||||
Graphical representation of an image on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore
|
||||
|
||||
|
||||
class ImageItem(QtGui.QGraphicsPixmapItem):
|
||||
class ImageItem():
|
||||
|
||||
"""
|
||||
Class to insert an image on the scene.
|
||||
"""
|
||||
|
||||
show_layer = False
|
||||
|
||||
def __init__(self, pixmap, image_path, pos=None):
|
||||
def __init__(self, image_path, pos=None):
|
||||
|
||||
QtGui.QGraphicsPixmapItem.__init__(self, pixmap)
|
||||
self.setFlags(self.ItemIsMovable | self.ItemIsSelectable)
|
||||
self.setTransformationMode(QtCore.Qt.SmoothTransformation)
|
||||
self._image_path = image_path
|
||||
if pos:
|
||||
self.setPos(pos)
|
||||
@@ -47,17 +46,6 @@ class ImageItem(QtGui.QGraphicsPixmapItem):
|
||||
from ..topology import Topology
|
||||
Topology.instance().removeImage(self)
|
||||
|
||||
def duplicate(self):
|
||||
"""
|
||||
Duplicates this image item.
|
||||
|
||||
:return: ImageItem instance
|
||||
"""
|
||||
|
||||
image_item = ImageItem(self.pixmap(), self._image_path, QtCore.QPointF(self.x() + 20, self.y() + 20))
|
||||
image_item.setZValue(self.zValue())
|
||||
return image_item
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
"""
|
||||
Paints the contents of an item in local coordinates.
|
||||
@@ -67,7 +55,7 @@ class ImageItem(QtGui.QGraphicsPixmapItem):
|
||||
:param widget: QWidget instance
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsPixmapItem.paint(self, painter, option, widget)
|
||||
super().paint(painter, option, widget)
|
||||
|
||||
if self.show_layer is False:
|
||||
return
|
||||
@@ -92,7 +80,7 @@ class ImageItem(QtGui.QGraphicsPixmapItem):
|
||||
:param value: Z value
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsPixmapItem.setZValue(self, value)
|
||||
super().setZValue(value)
|
||||
if self.zValue() < 0:
|
||||
self.setFlag(self.ItemIsSelectable, False)
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
|
||||
@@ -23,10 +23,11 @@ Link items are graphical representation of a link on the QGraphicsScene
|
||||
import math
|
||||
import struct
|
||||
import sys
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class LinkItem(QtGui.QGraphicsPathItem):
|
||||
class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
|
||||
"""
|
||||
Base class for link items.
|
||||
|
||||
@@ -43,8 +44,8 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
|
||||
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
|
||||
|
||||
QtGui.QGraphicsPathItem.__init__(self)
|
||||
self.setAcceptsHoverEvents(True)
|
||||
super().__init__()
|
||||
self.setAcceptHoverEvents(True)
|
||||
self.setZValue(-1)
|
||||
self._link = None
|
||||
|
||||
@@ -180,33 +181,33 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
|
||||
if not self._source_port.capturing() or not self._destination_port.capturing():
|
||||
# start capture
|
||||
start_capture_action = QtGui.QAction("Start capture", menu)
|
||||
start_capture_action = QtWidgets.QAction("Start capture", menu)
|
||||
start_capture_action.setIcon(QtGui.QIcon(':/icons/capture-start.svg'))
|
||||
start_capture_action.triggered.connect(self._startCaptureActionSlot)
|
||||
menu.addAction(start_capture_action)
|
||||
|
||||
if self._source_port.capturing() or self._destination_port.capturing():
|
||||
# stop capture
|
||||
stop_capture_action = QtGui.QAction("Stop capture", menu)
|
||||
stop_capture_action = QtWidgets.QAction("Stop capture", menu)
|
||||
stop_capture_action.setIcon(QtGui.QIcon(':/icons/capture-stop.svg'))
|
||||
stop_capture_action.triggered.connect(self._stopCaptureActionSlot)
|
||||
menu.addAction(stop_capture_action)
|
||||
|
||||
# start wireshark
|
||||
start_wireshark_action = QtGui.QAction("Start Wireshark", menu)
|
||||
start_wireshark_action = QtWidgets.QAction("Start Wireshark", menu)
|
||||
start_wireshark_action.setIcon(QtGui.QIcon(":/icons/wireshark.png"))
|
||||
start_wireshark_action.triggered.connect(self._startWiresharkActionSlot)
|
||||
menu.addAction(start_wireshark_action)
|
||||
|
||||
if sys.platform.startswith("win") and struct.calcsize("P") * 8 == 64:
|
||||
# Windows 64-bit only (Solarwinds RTV limitation).
|
||||
analyze_action = QtGui.QAction("Analyze capture", menu)
|
||||
analyze_action = QtWidgets.QAction("Analyze capture", menu)
|
||||
analyze_action.setIcon(QtGui.QIcon(':/icons/rtv.png'))
|
||||
analyze_action.triggered.connect(self._analyzeCaptureActionSlot)
|
||||
menu.addAction(analyze_action)
|
||||
|
||||
# delete
|
||||
delete_action = QtGui.QAction("Delete", menu)
|
||||
delete_action = QtWidgets.QAction("Delete", menu)
|
||||
delete_action.setIcon(QtGui.QIcon(':/icons/delete.svg'))
|
||||
delete_action.triggered.connect(self._deleteActionSlot)
|
||||
menu.addAction(delete_action)
|
||||
@@ -223,18 +224,30 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
# send a escape key to the main window to cancel the link addition
|
||||
from ..main_window import MainWindow
|
||||
key = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Escape, QtCore.Qt.NoModifier)
|
||||
QtGui.QApplication.sendEvent(MainWindow.instance(), key)
|
||||
QtWidgets.QApplication.sendEvent(MainWindow.instance(), key)
|
||||
return
|
||||
|
||||
# create the contextual menu
|
||||
self.setAcceptsHoverEvents(False)
|
||||
menu = QtGui.QMenu()
|
||||
self.setAcceptHoverEvents(False)
|
||||
menu = QtWidgets.QMenu()
|
||||
self.populateLinkContextualMenu(menu)
|
||||
menu.exec_(QtGui.QCursor.pos())
|
||||
self.setAcceptsHoverEvents(True)
|
||||
self.setAcceptHoverEvents(True)
|
||||
self._hovered = False
|
||||
self.adjust()
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
"""
|
||||
Handles all key press events
|
||||
|
||||
:param event: QKeyEvent
|
||||
"""
|
||||
|
||||
# On pressing backspace or delete key, the selected link gets deleted
|
||||
if event.key() == QtCore.Qt.Key_Delete or event.key() == QtCore.Qt.Key_Backspace:
|
||||
self._deleteActionSlot()
|
||||
return
|
||||
|
||||
def _deleteActionSlot(self):
|
||||
"""
|
||||
Slot to receive events from the delete action in the
|
||||
@@ -261,10 +274,10 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
ports[port] = [self._destination_item.node(), self._destination_port, dlt]
|
||||
|
||||
if not ports:
|
||||
QtGui.QMessageBox.critical(self._main_window, "Packet capture", "Packet capture is not supported on this link")
|
||||
QtWidgets.QMessageBox.critical(self._main_window, "Packet capture", "Packet capture is not supported on this link")
|
||||
return
|
||||
|
||||
selection, ok = QtGui.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", list(ports.keys()), 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", list(ports.keys()), 0, False)
|
||||
if ok:
|
||||
if selection in ports:
|
||||
node, port, dlt = ports[selection]
|
||||
@@ -282,7 +295,7 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
ports[source_port] = [self._source_item.node(), self._source_port]
|
||||
destination_port = "{} port {}".format(self._destination_item.node().name(), self._destination_port.name())
|
||||
ports[destination_port] = [self._destination_item.node(), self._destination_port]
|
||||
selection, ok = QtGui.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", list(ports.keys()), 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", list(ports.keys()), 0, False)
|
||||
if ok:
|
||||
if selection in ports:
|
||||
node, port = ports[selection]
|
||||
@@ -302,7 +315,7 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
if self._source_port.capturing() and self._destination_port.capturing():
|
||||
ports = ["{} port {}".format(self._source_item.node().name(), self._source_port.name()),
|
||||
"{} port {}".format(self._destination_item.node().name(), self._destination_port.name())]
|
||||
selection, ok = QtGui.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", ports, 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(self._main_window, "Packet capture", "Please select a port:", ports, 0, False)
|
||||
if ok:
|
||||
if selection.endswith(self._source_port.name()):
|
||||
self._source_port.startPacketCaptureReader()
|
||||
@@ -313,7 +326,7 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
elif self._destination_port.capturing():
|
||||
self._destination_port.startPacketCaptureReader()
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(self._main_window, "Packet capture", "Cannot start Wireshark: {}".format(e))
|
||||
QtWidgets.QMessageBox.critical(self._main_window, "Packet capture", "Cannot start Wireshark: {}".format(e))
|
||||
|
||||
def _analyzeCaptureActionSlot(self):
|
||||
"""
|
||||
@@ -325,7 +338,7 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
if self._source_port.capturing() and self._destination_port.capturing():
|
||||
ports = ["{} port {}".format(self._source_item.node().name(), self._source_port.name()),
|
||||
"{} port {}".format(self._destination_item.node().name(), self._destination_port.name())]
|
||||
selection, ok = QtGui.QInputDialog.getItem(self._main_window, "Capture analyzer", "Please select a port:", ports, 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(self._main_window, "Capture analyzer", "Please select a port:", ports, 0, False)
|
||||
if ok:
|
||||
if selection.endswith(self._source_port.name()):
|
||||
self._source_port.startPacketCaptureAnalyzer()
|
||||
@@ -336,7 +349,7 @@ class LinkItem(QtGui.QGraphicsPathItem):
|
||||
elif self._destination_port.capturing():
|
||||
self._destination_port.startPacketCaptureAnalyzer()
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(self._main_window, "Capture analyzer", "Cannot start the packet capture analyzer program: {}".format(e))
|
||||
QtWidgets.QMessageBox.critical(self._main_window, "Capture analyzer", "Cannot start the packet capture analyzer program: {}".format(e))
|
||||
|
||||
def setHovered(self, value):
|
||||
"""
|
||||
|
||||
@@ -19,24 +19,24 @@
|
||||
Graphical representation of a node on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui, QtSvg
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from .note_item import NoteItem
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class NodeItem():
|
||||
|
||||
class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
Node for the scene.
|
||||
|
||||
:param node: Node instance
|
||||
:param default_symbol: Default symbol for the node representation on the scene
|
||||
:param hover_symbol: Hover symbol when the node is hovered on the scene
|
||||
"""
|
||||
|
||||
show_layer = False
|
||||
|
||||
def __init__(self, node, default_symbol=None, hover_symbol=None):
|
||||
|
||||
QtSvg.QGraphicsSvgItem.__init__(self)
|
||||
def __init__(self, node):
|
||||
|
||||
# attached node
|
||||
self._node = node
|
||||
@@ -47,28 +47,23 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# link items connected to this node item.
|
||||
self._links = []
|
||||
|
||||
# set graphical settings for this node
|
||||
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsMovable)
|
||||
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsSelectable)
|
||||
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsFocusable)
|
||||
self.setFlag(QtSvg.QGraphicsSvgItem.ItemSendsGeometryChanges)
|
||||
self.setAcceptsHoverEvents(True)
|
||||
self.setZValue(1)
|
||||
effect = QtWidgets.QGraphicsColorizeEffect()
|
||||
effect.setColor(QtGui.QColor("black"))
|
||||
effect.setStrength(0.8)
|
||||
#effect = QtWidgets.QGraphicsDropShadowEffect()
|
||||
#effect.setColor(QtGui.QColor("darkGray"))
|
||||
#effect.setBlurRadius(0)
|
||||
#effect.setOffset(3, 3)
|
||||
self.setGraphicsEffect(effect)
|
||||
self.graphicsEffect().setEnabled(False)
|
||||
|
||||
# create renderers using symbols paths/resources
|
||||
if default_symbol:
|
||||
self._default_renderer = QtSvg.QSvgRenderer(default_symbol)
|
||||
if default_symbol != node.defaultSymbol():
|
||||
self._default_renderer.setObjectName(default_symbol)
|
||||
else:
|
||||
self._default_renderer = QtSvg.QSvgRenderer(node.defaultSymbol())
|
||||
if hover_symbol:
|
||||
self._hover_renderer = QtSvg.QSvgRenderer(hover_symbol)
|
||||
if hover_symbol != node.hoverSymbol():
|
||||
self._hover_renderer.setObjectName(hover_symbol)
|
||||
else:
|
||||
self._hover_renderer = QtSvg.QSvgRenderer(node.hoverSymbol())
|
||||
self.setSharedRenderer(self._default_renderer)
|
||||
# set graphical settings for this node
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges)
|
||||
self.setAcceptHoverEvents(True)
|
||||
self.setZValue(1)
|
||||
|
||||
# connect signals to know about some events
|
||||
# e.g. when the node has been started, stopped or suspended etc.
|
||||
@@ -93,42 +88,9 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# from the server.
|
||||
self._last_error = None
|
||||
|
||||
def defaultRenderer(self):
|
||||
"""
|
||||
Returns the default QSvgRenderer.
|
||||
|
||||
:return: QSvgRenderer instance
|
||||
"""
|
||||
|
||||
return self._default_renderer
|
||||
|
||||
def setDefaultRenderer(self, default_renderer):
|
||||
"""
|
||||
Sets new default QSvgRenderer.
|
||||
|
||||
:param default_renderer: QSvgRenderer instance
|
||||
"""
|
||||
|
||||
self._default_renderer = default_renderer
|
||||
self.setSharedRenderer(self._default_renderer)
|
||||
|
||||
def hoverRenderer(self):
|
||||
"""
|
||||
Returns the hover QSvgRenderer.
|
||||
|
||||
:return: QSvgRenderer instance
|
||||
"""
|
||||
|
||||
return self._hover_renderer
|
||||
|
||||
def setHoverRenderer(self, hover_renderer):
|
||||
"""
|
||||
Sets new hover QSvgRenderer.
|
||||
|
||||
:param hover_renderer: QSvgRenderer instance
|
||||
"""
|
||||
|
||||
self._hover_renderer = hover_renderer
|
||||
from ..main_window import MainWindow
|
||||
self._main_window = MainWindow.instance()
|
||||
self._settings = self._main_window.uiGraphicsView.settings()
|
||||
|
||||
def setUnsavedState(self):
|
||||
"""
|
||||
@@ -225,7 +187,9 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
if self._node_label:
|
||||
self._node_label.setPlainText(self._node.name())
|
||||
if self._node_label.toPlainText() != self._node.name():
|
||||
self._node_label.setPlainText(self._node.name())
|
||||
self._centerLabel()
|
||||
self.setUnsavedState()
|
||||
|
||||
# update the link tooltips in case the
|
||||
@@ -253,13 +217,12 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
self.scene().removeItem(self)
|
||||
self.setUnsavedState()
|
||||
|
||||
def serverErrorSlot(self, node_id, code, message):
|
||||
def serverErrorSlot(self, node_id, message):
|
||||
"""
|
||||
Slot to receive events from the attached Node instance
|
||||
when the node has received an error from the server.
|
||||
|
||||
:param node_id: node identifier
|
||||
:param code: error code
|
||||
:param message: error message
|
||||
"""
|
||||
|
||||
@@ -308,6 +271,19 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
|
||||
self._node_label = label
|
||||
|
||||
def _centerLabel(self):
|
||||
"""
|
||||
Centers the node label.
|
||||
"""
|
||||
|
||||
text_rect = self._node_label.boundingRect()
|
||||
text_middle = text_rect.topRight() / 2
|
||||
node_rect = self.boundingRect()
|
||||
node_middle = node_rect.topRight() / 2
|
||||
label_x_pos = node_middle.x() - text_middle.x()
|
||||
label_y_pos = -25
|
||||
self._node_label.setPos(label_x_pos, label_y_pos)
|
||||
|
||||
def _showLabel(self):
|
||||
"""
|
||||
Shows the node label on the scene.
|
||||
@@ -317,13 +293,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
self._node_label = NoteItem(self)
|
||||
self._node_label.setEditable(False)
|
||||
self._node_label.setPlainText(self._node.name())
|
||||
text_rect = self._node_label.boundingRect()
|
||||
text_middle = text_rect.topRight() / 2
|
||||
node_rect = self.boundingRect()
|
||||
node_middle = node_rect.topRight() / 2
|
||||
label_x_pos = node_middle.x() - text_middle.x()
|
||||
label_y_pos = -25
|
||||
self._node_label.setPos(label_x_pos, label_y_pos)
|
||||
self._centerLabel()
|
||||
|
||||
def connectToPort(self, unavailable_ports=[]):
|
||||
"""
|
||||
@@ -335,35 +305,43 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
self._selected_port = None
|
||||
menu = QtGui.QMenu()
|
||||
menu = QtWidgets.QMenu()
|
||||
ports = self._node.ports()
|
||||
if not ports:
|
||||
QtGui.QMessageBox.critical(self.scene().parent(), "Link", "No port available, please configure this device")
|
||||
QtWidgets.QMessageBox.critical(self.scene().parent(), "Link", "No port available, please configure this device")
|
||||
return None
|
||||
|
||||
# sort by port name
|
||||
port_names = {}
|
||||
# sort the ports
|
||||
ports_dict = {}
|
||||
for port in ports:
|
||||
port_names[port.name()] = port
|
||||
if port.adapterNumber() is not None:
|
||||
# make the port number unique (special case with WICs).
|
||||
port_number = port.portNumber()
|
||||
if port_number >= 16:
|
||||
port_number *= 8
|
||||
ports_dict[(port.adapterNumber() * 16) + port_number] = port
|
||||
elif port.portNumber()is not None:
|
||||
ports_dict[port.portNumber()] = port
|
||||
else:
|
||||
ports_dict[port.name()] = port
|
||||
|
||||
try:
|
||||
# try a numeric sort first
|
||||
ports = sorted(port_names.keys(), key=int)
|
||||
ports = sorted(ports_dict.keys(), key=int)
|
||||
except ValueError:
|
||||
# fall back to a classic sort
|
||||
ports = sorted(port_names.keys())
|
||||
ports = sorted(ports_dict.keys())
|
||||
|
||||
# show a contextual menu for the user to choose a port
|
||||
for port in ports:
|
||||
port_object = port_names[port]
|
||||
port_object = ports_dict[port]
|
||||
log.debug("Node '{}' Port {} Type {}".format(self.node(), port_object.name(), type(port_object.name())))
|
||||
if port in unavailable_ports:
|
||||
# this port cannot be chosen by the user (grayed out)
|
||||
action = menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port)
|
||||
action = menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port_object.name())
|
||||
action.setDisabled(True)
|
||||
elif port_object.isFree():
|
||||
menu.addAction(QtGui.QIcon(':/icons/led_red.svg'), port)
|
||||
menu.addAction(QtGui.QIcon(':/icons/led_red.svg'), port_object.name())
|
||||
else:
|
||||
menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port)
|
||||
menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port_object.name())
|
||||
|
||||
menu.triggered.connect(self.selectedPortSlot)
|
||||
menu.exec_(QtGui.QCursor.pos())
|
||||
@@ -394,19 +372,19 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
# dynamically change the renderer when this node item is selected/unselected.
|
||||
if change == QtSvg.QGraphicsSvgItem.ItemSelectedChange:
|
||||
if change == QtWidgets.QGraphicsItem.ItemSelectedChange:
|
||||
if value:
|
||||
self.setSharedRenderer(self._hover_renderer)
|
||||
self.graphicsEffect().setEnabled(True)
|
||||
else:
|
||||
self.setSharedRenderer(self._default_renderer)
|
||||
self.graphicsEffect().setEnabled(False)
|
||||
|
||||
# adjust link item positions when this node is moving or has changed.
|
||||
if change == QtSvg.QGraphicsSvgItem.ItemPositionChange or change == QtSvg.QGraphicsSvgItem.ItemPositionHasChanged:
|
||||
if change == QtWidgets.QGraphicsItem.ItemPositionChange or change == QtWidgets.QGraphicsItem.ItemPositionHasChanged:
|
||||
self.setUnsavedState()
|
||||
for link in self._links:
|
||||
link.adjust()
|
||||
|
||||
return QtGui.QGraphicsItem.itemChange(self, change, value)
|
||||
return QtWidgets.QGraphicsItem.itemChange(self, change, value)
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
"""
|
||||
@@ -418,8 +396,9 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
# don't show the selection rectangle
|
||||
option.state = QtGui.QStyle.State_None
|
||||
QtSvg.QGraphicsSvgItem.paint(self, painter, option, widget)
|
||||
if not self._settings["draw_rectangle_selected_item"]:
|
||||
option.state = QtWidgets.QStyle.State_None
|
||||
super().paint(painter, option, widget)
|
||||
|
||||
if not self._initialized or self.show_layer:
|
||||
brect = self.boundingRect()
|
||||
@@ -443,7 +422,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
:param value: Z value
|
||||
"""
|
||||
|
||||
QtSvg.QGraphicsSvgItem.setZValue(self, value)
|
||||
super().setZValue(value)
|
||||
if self.zValue() < 0:
|
||||
self.setFlag(self.ItemIsSelectable, False)
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
@@ -467,13 +446,8 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
self.setCustomToolTip()
|
||||
# dynamically change the renderer when this node item is hovered.
|
||||
if not self.isSelected():
|
||||
self.setSharedRenderer(self._hover_renderer)
|
||||
#effect = QtGui.QGraphicsColorizeEffect()
|
||||
#effect.setColor(QtGui.QColor("black"))
|
||||
#effect.setStrength(0.8)
|
||||
#self.setGraphicsEffect(effect)
|
||||
self.graphicsEffect().setEnabled(True)
|
||||
|
||||
def hoverLeaveEvent(self, event):
|
||||
"""
|
||||
@@ -482,7 +456,5 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
:param event: QGraphicsSceneHoverEvent instance
|
||||
"""
|
||||
|
||||
# dynamically change the renderer back to the default when this node item is not hovered anymore.
|
||||
if not self.isSelected():
|
||||
self.setSharedRenderer(self._default_renderer)
|
||||
#self.graphicsEffect().setEnabled(False)
|
||||
self.graphicsEffect().setEnabled(False)
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
Graphical representation of a note on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtWidgets, QtGui
|
||||
|
||||
|
||||
class NoteItem(QtGui.QGraphicsTextItem):
|
||||
class NoteItem(QtWidgets.QGraphicsTextItem):
|
||||
"""
|
||||
Text note for the QGraphicsView.
|
||||
|
||||
@@ -33,9 +33,10 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
QtGui.QGraphicsTextItem.__init__(self, parent)
|
||||
super().__init__(parent)
|
||||
|
||||
from ..main_window import MainWindow
|
||||
|
||||
main_window = MainWindow.instance()
|
||||
view_settings = main_window.uiGraphicsView.settings()
|
||||
qt_font = QtGui.QFont()
|
||||
@@ -58,6 +59,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
|
||||
self.scene().removeItem(self)
|
||||
from ..topology import Topology
|
||||
|
||||
Topology.instance().removeNote(self)
|
||||
|
||||
def editable(self):
|
||||
@@ -77,9 +79,9 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
"""
|
||||
|
||||
self._editable = value
|
||||
#if not self._editable:
|
||||
# if not self._editable:
|
||||
# self.setFlag(self.ItemIsSelectable, enabled=False)
|
||||
#else:
|
||||
# else:
|
||||
# self.setFlag(self.ItemIsSelectable)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
@@ -100,7 +102,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
if self.rotation() < 360.0:
|
||||
self.setRotation(self.rotation() + 1)
|
||||
else:
|
||||
QtGui.QGraphicsTextItem.keyPressEvent(self, event)
|
||||
super().keyPressEvent(event)
|
||||
|
||||
def editText(self):
|
||||
"""
|
||||
@@ -131,7 +133,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
:param event: QFocusEvent instance
|
||||
"""
|
||||
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsFocusable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable, False)
|
||||
cursor = self.textCursor()
|
||||
if cursor.hasSelection():
|
||||
cursor.clearSelection()
|
||||
@@ -141,7 +143,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
# delete the note if empty
|
||||
self.delete()
|
||||
return
|
||||
return QtGui.QGraphicsTextItem.focusOutEvent(self, event)
|
||||
return super().focusOutEvent(event)
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
"""
|
||||
@@ -152,7 +154,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
:param widget: QWidget instance
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsTextItem.paint(self, painter, option, widget)
|
||||
super().paint(painter, option, widget)
|
||||
|
||||
if self.show_layer is False or self.parentItem():
|
||||
return
|
||||
@@ -177,7 +179,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
:param value: Z value
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsTextItem.setZValue(self, value)
|
||||
super().setZValue(value)
|
||||
if self.zValue() < 0:
|
||||
self.setFlag(self.ItemIsSelectable, False)
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
@@ -197,7 +199,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
"y": self.y()}
|
||||
|
||||
note_info["font"] = self.font().toString()
|
||||
note_info["color"] = self.defaultTextColor().name()
|
||||
note_info["color"] = self.defaultTextColor().name(QtGui.QColor.HexArgb)
|
||||
if self.rotation() != 0:
|
||||
note_info["rotation"] = self.rotation()
|
||||
if self.zValue() != 2:
|
||||
@@ -234,7 +236,7 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
if color:
|
||||
self.setDefaultTextColor(QtGui.QColor(color))
|
||||
if rotation is not None:
|
||||
self.setRotation(rotation)
|
||||
self.setRotation(float(rotation))
|
||||
if z is not None:
|
||||
self.setZValue(z)
|
||||
|
||||
|
||||
47
gns3/items/pixmap_image_item.py
Normal file
47
gns3/items/pixmap_image_item.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Graphical representation of a Pixmap image on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtWidgets
|
||||
from .image_item import ImageItem
|
||||
|
||||
|
||||
class PixmapImageItem(ImageItem, QtWidgets.QGraphicsPixmapItem):
|
||||
|
||||
"""
|
||||
Class to insert an pixmap image on the scene.
|
||||
"""
|
||||
|
||||
def __init__(self, pixmap, image_path, pos=None):
|
||||
|
||||
QtWidgets.QGraphicsPixmapItem.__init__(self, pixmap)
|
||||
ImageItem.__init__(self, image_path, pos)
|
||||
self.setTransformationMode(QtCore.Qt.SmoothTransformation)
|
||||
|
||||
def duplicate(self):
|
||||
"""
|
||||
Duplicates this image item.
|
||||
|
||||
:return: PixmapImageItem instance
|
||||
"""
|
||||
|
||||
image_item = PixmapImageItem(self.pixmap(), self._image_path, QtCore.QPointF(self.x() + 20, self.y() + 20))
|
||||
image_item.setZValue(self.zValue())
|
||||
return image_item
|
||||
54
gns3/items/pixmap_node_item.py
Normal file
54
gns3/items/pixmap_node_item.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Graphical representation of a pixmap node on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtGui, QtWidgets
|
||||
from .node_item import NodeItem
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PixmapNodeItem(NodeItem, QtWidgets.QGraphicsPixmapItem):
|
||||
|
||||
"""
|
||||
Pixmap node for the scene.
|
||||
|
||||
:param node: Node instance
|
||||
:param pixmap_symbol: symbol for the node representation on the scene
|
||||
"""
|
||||
|
||||
def __init__(self, node, pixmap_symbol_path):
|
||||
|
||||
QtWidgets.QGraphicsPixmapItem.__init__(self)
|
||||
NodeItem.__init__(self, node)
|
||||
|
||||
self._pixmap_symbol_path = pixmap_symbol_path
|
||||
pixmap = QtGui.QPixmap(pixmap_symbol_path)
|
||||
self.setPixmap(pixmap)
|
||||
|
||||
def pixmapSymbolPath(self):
|
||||
"""
|
||||
Returns the pixmap path
|
||||
|
||||
:return: path to the Pixmap file.
|
||||
"""
|
||||
|
||||
return self._pixmap_symbol_path
|
||||
@@ -19,19 +19,20 @@
|
||||
Graphical representation of a rectangle on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from .shape_item import ShapeItem
|
||||
|
||||
|
||||
class RectangleItem(ShapeItem, QtGui.QGraphicsRectItem):
|
||||
class RectangleItem(QtWidgets.QGraphicsRectItem, ShapeItem):
|
||||
|
||||
"""
|
||||
Class to draw a rectangle on the scene.
|
||||
"""
|
||||
|
||||
def __init__(self, pos=None, width=200, height=100):
|
||||
|
||||
QtGui.QGraphicsRectItem.__init__(self, 0, 0, width, height)
|
||||
ShapeItem.__init__(self)
|
||||
super().__init__()
|
||||
self.setRect(0, 0, width, height)
|
||||
pen = QtGui.QPen(QtCore.Qt.black, 2, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
|
||||
self.setPen(pen)
|
||||
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 255)) # default color is white and not transparent
|
||||
@@ -57,7 +58,7 @@ class RectangleItem(ShapeItem, QtGui.QGraphicsRectItem):
|
||||
:param widget: QWidget instance
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsRectItem.paint(self, painter, option, widget)
|
||||
super().paint(painter, option, widget)
|
||||
self.drawLayerInfo(painter)
|
||||
|
||||
def duplicate(self):
|
||||
|
||||
@@ -20,13 +20,14 @@ Graphical representation of a Serial link on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
import math
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
from .link_item import LinkItem
|
||||
from .note_item import NoteItem
|
||||
from ..ports.port import Port
|
||||
|
||||
|
||||
class SerialLinkItem(LinkItem):
|
||||
|
||||
"""
|
||||
Serial link for the scene.
|
||||
|
||||
@@ -41,7 +42,7 @@ class SerialLinkItem(LinkItem):
|
||||
|
||||
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
|
||||
|
||||
LinkItem.__init__(self, source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
|
||||
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
|
||||
|
||||
def adjust(self):
|
||||
"""
|
||||
@@ -88,7 +89,7 @@ class SerialLinkItem(LinkItem):
|
||||
:returns: QPainterPath instance
|
||||
"""
|
||||
|
||||
path = QtGui.QGraphicsPathItem.shape(self)
|
||||
path = QtWidgets.QGraphicsPathItem.shape(self)
|
||||
offset = self._point_size / 2
|
||||
point = self.source
|
||||
path.addEllipse(point.x() - offset, point.y() - offset, self._point_size, self._point_size)
|
||||
@@ -105,7 +106,7 @@ class SerialLinkItem(LinkItem):
|
||||
:param widget: QWidget instance.
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsPathItem.paint(self, painter, option, widget)
|
||||
QtWidgets.QGraphicsPathItem.paint(self, painter, option, widget)
|
||||
|
||||
if not self._adding_flag and self._settings["draw_link_status_points"]:
|
||||
|
||||
|
||||
@@ -19,20 +19,21 @@
|
||||
Base class for shape items (Rectangle, ellipse etc.).
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtGui
|
||||
from ..qt import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class ShapeItem:
|
||||
|
||||
"""
|
||||
Base class to draw shapes on the scene.
|
||||
"""
|
||||
|
||||
show_layer = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, **kws):
|
||||
|
||||
self.setFlags(QtGui.QGraphicsItem.ItemIsMovable | QtGui.QGraphicsItem.ItemIsFocusable | QtGui.QGraphicsItem.ItemIsSelectable)
|
||||
self.setAcceptsHoverEvents(True)
|
||||
self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable | QtWidgets.QGraphicsItem.ItemIsFocusable | QtWidgets.QGraphicsItem.ItemIsSelectable)
|
||||
self.setAcceptHoverEvents(True)
|
||||
self._border = 5
|
||||
self._edge = None
|
||||
|
||||
@@ -57,7 +58,7 @@ class ShapeItem:
|
||||
if self.rotation() < 360.0:
|
||||
self.setRotation(self.rotation() + 1)
|
||||
else:
|
||||
QtGui.QGraphicsItem.keyPressEvent(self, event)
|
||||
QtWidgets.QGraphicsItem.keyPressEvent(self, event)
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
"""
|
||||
@@ -68,22 +69,22 @@ class ShapeItem:
|
||||
|
||||
self.update()
|
||||
if event.pos().x() > (self.rect().right() - self._border):
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self._edge = "right"
|
||||
|
||||
elif event.pos().x() < (self.rect().left() + self._border):
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self._edge = "left"
|
||||
|
||||
elif event.pos().y() < (self.rect().top() + self._border):
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self._edge = "top"
|
||||
|
||||
elif event.pos().y() > (self.rect().bottom() - self._border):
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self._edge = "bottom"
|
||||
|
||||
QtGui.QGraphicsItem.mousePressEvent(self, event)
|
||||
QtWidgets.QGraphicsItem.mousePressEvent(self, event)
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
"""
|
||||
@@ -93,9 +94,9 @@ class ShapeItem:
|
||||
"""
|
||||
|
||||
self.update()
|
||||
self.setFlag(QtGui.QGraphicsItem.ItemIsMovable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
|
||||
self._edge = None
|
||||
QtGui.QGraphicsItem.mouseReleaseEvent(self, event)
|
||||
QtWidgets.QGraphicsItem.mouseReleaseEvent(self, event)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
"""
|
||||
@@ -144,7 +145,7 @@ class ShapeItem:
|
||||
self.setPos(scenePos.x(), self.y())
|
||||
self._edge = "left"
|
||||
|
||||
QtGui.QGraphicsItem.mouseMoveEvent(self, event)
|
||||
QtWidgets.QGraphicsItem.mouseMoveEvent(self, event)
|
||||
|
||||
def hoverMoveEvent(self, event):
|
||||
"""
|
||||
@@ -207,7 +208,7 @@ class ShapeItem:
|
||||
:param value: Z value
|
||||
"""
|
||||
|
||||
QtGui.QGraphicsItem.setZValue(self, value)
|
||||
QtWidgets.QGraphicsItem.setZValue(self, value)
|
||||
if self.zValue() < 0:
|
||||
self.setFlag(self.ItemIsSelectable, False)
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
@@ -280,7 +281,7 @@ class ShapeItem:
|
||||
color = QtGui.QColor(color)
|
||||
else:
|
||||
color = QtGui.QColor(255, 255, 255)
|
||||
if transparency:
|
||||
if transparency is not None:
|
||||
color.setAlpha(transparency)
|
||||
self.setBrush(QtGui.QBrush(color))
|
||||
|
||||
@@ -294,7 +295,7 @@ class ShapeItem:
|
||||
pen.setColor(border_color)
|
||||
if border_width is not None:
|
||||
pen.setWidth(int(border_width))
|
||||
if border_style:
|
||||
if border_style is not None:
|
||||
pen.setStyle(QtCore.Qt.PenStyle(border_style))
|
||||
self.setPen(pen)
|
||||
|
||||
|
||||
47
gns3/items/svg_image_item.py
Normal file
47
gns3/items/svg_image_item.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Graphical representation of a SVG image on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtCore, QtSvg
|
||||
from .image_item import ImageItem
|
||||
|
||||
|
||||
class SvgImageItem(ImageItem, QtSvg.QGraphicsSvgItem):
|
||||
|
||||
"""
|
||||
Class to insert a SVG image on the scene.
|
||||
"""
|
||||
|
||||
def __init__(self, renderer, image_path, pos=None):
|
||||
|
||||
QtSvg.QGraphicsSvgItem.__init__(self)
|
||||
ImageItem.__init__(self, image_path, pos)
|
||||
self.setSharedRenderer(renderer)
|
||||
|
||||
def duplicate(self):
|
||||
"""
|
||||
Duplicates this image item.
|
||||
|
||||
:return: SvgImageItem instance
|
||||
"""
|
||||
|
||||
image_item = SvgImageItem(self.renderer(), self._image_path, QtCore.QPointF(self.x() + 20, self.y() + 20))
|
||||
image_item.setZValue(self.zValue())
|
||||
return image_item
|
||||
50
gns3/items/svg_node_item.py
Normal file
50
gns3/items/svg_node_item.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Graphical representation of a SVG node on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import QtSvg
|
||||
from .node_item import NodeItem
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SvgNodeItem(NodeItem, QtSvg.QGraphicsSvgItem):
|
||||
|
||||
"""
|
||||
SVG node for the scene.
|
||||
|
||||
:param node: Node instance
|
||||
:param symbol: symbol for the node representation on the scene
|
||||
"""
|
||||
|
||||
def __init__(self, node, symbol=None):
|
||||
|
||||
QtSvg.QGraphicsSvgItem.__init__(self)
|
||||
NodeItem.__init__(self, node)
|
||||
|
||||
# create renderer using symbols path/resource
|
||||
if symbol:
|
||||
renderer = QtSvg.QSvgRenderer(symbol)
|
||||
if symbol != node.defaultSymbol():
|
||||
renderer.setObjectName(symbol)
|
||||
else:
|
||||
renderer = QtSvg.QSvgRenderer(node.defaultSymbol())
|
||||
self.setSharedRenderer(renderer)
|
||||
184
gns3/jsonrpc.py
184
gns3/jsonrpc.py
@@ -1,184 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
JSON-RPC protocol implementation.
|
||||
http://www.jsonrpc.org/specification
|
||||
"""
|
||||
|
||||
import json
|
||||
import uuid
|
||||
|
||||
|
||||
class JSONRPCObject(object):
|
||||
"""
|
||||
Base object for JSON-RPC requests, responses,
|
||||
notifications and errors.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
return JSONRPCEncoder().default(self)
|
||||
|
||||
def __str__(self, *args, **kwargs):
|
||||
return json.dumps(self, cls=JSONRPCEncoder)
|
||||
|
||||
def __call__(self):
|
||||
return JSONRPCEncoder().default(self)
|
||||
|
||||
|
||||
class JSONRPCEncoder(json.JSONEncoder):
|
||||
"""
|
||||
Creates the JSON-RPC message.
|
||||
"""
|
||||
|
||||
def default(self, obj):
|
||||
"""
|
||||
Returns a Python dictionary corresponding to a JSON-RPC message.
|
||||
"""
|
||||
|
||||
if isinstance(obj, JSONRPCObject):
|
||||
message = {"jsonrpc": 2.0}
|
||||
for field in dir(obj):
|
||||
if not field.startswith('_'):
|
||||
value = getattr(obj, field)
|
||||
message[field] = value
|
||||
return message
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
|
||||
class JSONRPCInvalidRequest(JSONRPCObject):
|
||||
"""
|
||||
Error response for an invalid request.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = None
|
||||
self.error = {"code": -32600, "message": "Invalid Request"}
|
||||
|
||||
|
||||
class JSONRPCMethodNotFound(JSONRPCObject):
|
||||
"""
|
||||
Error response for an method not found.
|
||||
|
||||
:param request_id: JSON-RPC identifier
|
||||
"""
|
||||
|
||||
def __init__(self, request_id):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = request_id
|
||||
self.error = {"code": -32601, "message": "Method not found"}
|
||||
|
||||
|
||||
class JSONRPCInvalidParams(JSONRPCObject):
|
||||
"""
|
||||
Error response for invalid parameters.
|
||||
|
||||
:param request_id: JSON-RPC identifier
|
||||
"""
|
||||
|
||||
def __init__(self, request_id):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = request_id
|
||||
self.error = {"code": -32602, "message": "Invalid params"}
|
||||
|
||||
|
||||
class JSONRPCInternalError(JSONRPCObject):
|
||||
"""
|
||||
Error response for an internal error.
|
||||
|
||||
:param request_id: JSON-RPC identifier (optional)
|
||||
"""
|
||||
|
||||
def __init__(self, request_id=None):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = request_id
|
||||
self.error = {"code": -32603, "message": "Internal error"}
|
||||
|
||||
|
||||
class JSONRPCParseError(JSONRPCObject):
|
||||
"""
|
||||
Error response for parsing error.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = None
|
||||
self.error = {"code": -32700, "message": "Parse error"}
|
||||
|
||||
|
||||
class JSONRPCCustomError(JSONRPCObject):
|
||||
"""
|
||||
Error response for an custom error.
|
||||
|
||||
:param code: JSON-RPC error code
|
||||
:param message: JSON-RPC error message
|
||||
:param request_id: JSON-RPC identifier (optional)
|
||||
"""
|
||||
|
||||
def __init__(self, code, message, request_id=None):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = request_id
|
||||
self.error = {"code": code, "message": message}
|
||||
|
||||
|
||||
class JSONRPCResponse(JSONRPCObject):
|
||||
"""
|
||||
JSON-RPC successful response.
|
||||
|
||||
:param result: JSON-RPC result
|
||||
:param request_id: JSON-RPC identifier
|
||||
"""
|
||||
|
||||
def __init__(self, result, request_id):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.id = request_id
|
||||
self.result = result
|
||||
|
||||
|
||||
class JSONRPCRequest(JSONRPCObject):
|
||||
"""
|
||||
JSON-RPC request.
|
||||
|
||||
:param method: JSON-RPC destination method
|
||||
:param params: JSON-RPC params for the corresponding method (optional)
|
||||
:param request_id: JSON-RPC identifier (generated by default)
|
||||
"""
|
||||
|
||||
def __init__(self, method, params=None, request_id=None):
|
||||
JSONRPCObject.__init__(self)
|
||||
if request_id == None:
|
||||
request_id = str(uuid.uuid4())
|
||||
self.id = request_id
|
||||
self.method = method
|
||||
if params:
|
||||
self.params = params
|
||||
|
||||
|
||||
class JSONRPCNotification(JSONRPCObject):
|
||||
"""
|
||||
JSON-RPC notification.
|
||||
|
||||
:param method: JSON-RPC destination method
|
||||
:param params: JSON-RPC params for the corresponding method (optional)
|
||||
"""
|
||||
|
||||
def __init__(self, method, params=None):
|
||||
JSONRPCObject.__init__(self)
|
||||
self.method = method
|
||||
if params:
|
||||
self.params = params
|
||||
75
gns3/licence.py
Normal file
75
gns3/licence.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import rsa
|
||||
import sys
|
||||
import os
|
||||
import base64
|
||||
|
||||
PUB_KEY = b"""-----BEGIN RSA PUBLIC KEY-----
|
||||
MIICCgKCAgEAiE4Zgzge3Cg6EUfct7vnzcmXkIvsy6g/QkfEeKSz3Cd+L7kxVZGE
|
||||
weOXySrSSrRBoF1i2JhL2KkqZTY31972deviL+fv+TgE5RueyERFey3fw7+oN/RW
|
||||
i8UIUvRqHjwocCuJq5yUiOv+AdGKG3TNeYXvx4Xvnrr4AJnJRThDfqd0nr8QAXRn
|
||||
/Ifx4MKivL8RDyqHoVlHvHeyJmtaZIzsYthsK3FU2XED6d6xwbga3t2cb4+DfJa3
|
||||
rBtWnoIXHiRdZZUtl34dGiiyxKL2yco+Dpd5pUvw6F7+n77SnSwN+F0ZzrrgUMHA
|
||||
vBHBnF4WB6mjRFxbO+B/H1OxnXcjwxgYWLCbkrhQogqyfdkmacppWLOH9OyzGUkY
|
||||
r7qITLCWSAHuIqXmQF4VAqCPYwEK7o6ndebFk1jaAAPGIw52AA1YOSXJ6jpKiO7f
|
||||
5gXT3xRfv4kW1Fp6le0hp0Laz6VGbOv44vauxk516v5MI+CUL3u5TOmGWM53u1OG
|
||||
qq6SfL+5Cu0/4L+SUaJ7nzN+PgWx6BEd0LRzEVQcmRPA4zHbhJ7ebBbYOul9RFyW
|
||||
8D7yy7mUQZwVQDcuaB6l2pu0BfZppb+Uf81h0nRQIrHt7BRBiyaGojQIHsw8CrqP
|
||||
3fsnHUvqtNLipC26FSTW4wlPIEktsWU8TABgjbuS45+zFTI141/J77ECAwEAAQ==
|
||||
-----END RSA PUBLIC KEY-----"""
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def checkLicence():
|
||||
"""
|
||||
Return true if the user as correctly installed the licence file
|
||||
"""
|
||||
appname = "GNS3"
|
||||
|
||||
filename = "licence.txt"
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
# On windows, the user specific configuration file location is %APPDATA%/GNS3/gns3_gui.conf
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
licence_file = os.path.join(appdata, appname, filename)
|
||||
|
||||
else:
|
||||
# On UNIX-like platforms, the user specific configuration file location is /etc/xdg/GNS3/gns3_gui.conf
|
||||
home = os.path.expanduser("~")
|
||||
licence_file = os.path.join(home, ".config", appname, filename)
|
||||
|
||||
return check_licence_file(licence_file)
|
||||
|
||||
|
||||
def check_licence_file(licence_file):
|
||||
if os.path.exists(licence_file):
|
||||
with open(licence_file) as f:
|
||||
email = f.readline().strip()
|
||||
key = f.readline().strip()
|
||||
pubkey = rsa.PublicKey.load_pkcs1(PUB_KEY)
|
||||
try:
|
||||
rsa.verify(email.encode("utf-8"), base64.b64decode(key), pubkey)
|
||||
log.info("Found a valid licence file. Thanks for your support")
|
||||
return True
|
||||
except rsa.pkcs1.VerificationError:
|
||||
log.error("Invalid licence file.")
|
||||
return False
|
||||
return False
|
||||
48
gns3/link.py
48
gns3/link.py
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Link(QtCore.QObject):
|
||||
|
||||
"""
|
||||
Link implementation.
|
||||
|
||||
@@ -47,7 +48,7 @@ class Link(QtCore.QObject):
|
||||
|
||||
def __init__(self, source_node, source_port, destination_node, destination_port):
|
||||
|
||||
super(Link, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
log.info("adding link from {} {} to {} {}".format(source_node.name(),
|
||||
source_port.name(),
|
||||
@@ -136,10 +137,12 @@ class Link(QtCore.QObject):
|
||||
self._destination_port.name()))
|
||||
|
||||
# delete the NIOs on both source and destination nodes
|
||||
self._source_node.deleteNIO(self._source_port)
|
||||
if self._source_port.nio():
|
||||
self._source_node.deleteNIO(self._source_port)
|
||||
self._source_port.setFree()
|
||||
self._source_node.updated_signal.emit()
|
||||
self._destination_node.deleteNIO(self._destination_port)
|
||||
if self._destination_port.nio():
|
||||
self._destination_node.deleteNIO(self._destination_port)
|
||||
self._destination_port.setFree()
|
||||
self._destination_node.updated_signal.emit()
|
||||
|
||||
@@ -203,7 +206,7 @@ class Link(QtCore.QObject):
|
||||
|
||||
# check that the node is connected to this link as a source
|
||||
if node_id == self._source_node.id() and port_id == self._source_port.id():
|
||||
laddr = self._source_node.server().host
|
||||
laddr = self._source_node.server().host()
|
||||
self._source_udp = (lport, laddr)
|
||||
# disconnect the signal has we don't expect new source UDP info for this link.
|
||||
self._source_node.allocate_udp_nio_signal.disconnect(self.UDPPortAllocatedSlot)
|
||||
@@ -214,7 +217,7 @@ class Link(QtCore.QObject):
|
||||
|
||||
# check that the node is connected to this link as a destination
|
||||
elif node_id == self._destination_node.id() and port_id == self._destination_port.id():
|
||||
laddr = self._destination_node.server().host
|
||||
laddr = self._destination_node.server().host()
|
||||
self._destination_udp = (lport, laddr)
|
||||
# disconnect the signal has we don't expect new source UDP info for this link.
|
||||
self._destination_node.allocate_udp_nio_signal.disconnect(self.UDPPortAllocatedSlot)
|
||||
@@ -335,29 +338,19 @@ class Link(QtCore.QObject):
|
||||
"""
|
||||
|
||||
if not self._stub:
|
||||
if self._source_node.id() != node_id:
|
||||
try:
|
||||
# the destination node has canceled its NIO allocation
|
||||
self._destination_node.nio_signal.disconnect(self.newNIOSlot)
|
||||
except TypeError:
|
||||
# ignore TypeError: 'method' object is not connected
|
||||
pass
|
||||
try:
|
||||
# the destination node has canceled its NIO allocation
|
||||
self._destination_node.nio_signal.disconnect(self.newNIOSlot)
|
||||
except TypeError:
|
||||
# ignore TypeError: 'method' object is not connected
|
||||
pass
|
||||
|
||||
self._source_node.deleteNIO(self._source_port)
|
||||
self._source_port.setFree()
|
||||
self._source_node.updated_signal.emit()
|
||||
|
||||
elif self._destination_node.id() != node_id:
|
||||
try:
|
||||
# the source node has canceled its NIO allocation
|
||||
self._source_node.nio_signal.disconnect(self.newNIOSlot)
|
||||
except TypeError:
|
||||
# ignore TypeError: 'method' object is not connected
|
||||
pass
|
||||
|
||||
self._destination_node.deleteNIO(self._destination_port)
|
||||
self._destination_port.setFree()
|
||||
self._destination_node.updated_signal.emit()
|
||||
try:
|
||||
# the source node has canceled its NIO allocation
|
||||
self._source_node.nio_signal.disconnect(self.newNIOSlot)
|
||||
except TypeError:
|
||||
# ignore TypeError: 'method' object is not connected
|
||||
pass
|
||||
|
||||
self._source_node.nio_cancel_signal.disconnect(self.cancelNIOSlot)
|
||||
self._destination_node.nio_cancel_signal.disconnect(self.cancelNIOSlot)
|
||||
@@ -371,6 +364,7 @@ class Link(QtCore.QObject):
|
||||
|
||||
self._source_nio_active = False
|
||||
self._destination_nio_active = False
|
||||
self.deleteLink()
|
||||
|
||||
def dump(self):
|
||||
"""
|
||||
|
||||
310
gns3/local_config.py
Normal file
310
gns3/local_config.py
Normal file
@@ -0,0 +1,310 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import shutil
|
||||
import copy
|
||||
from pkg_resources import parse_version
|
||||
|
||||
|
||||
from .qt import QtCore
|
||||
from .version import __version__
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PeriodicCheckConfig(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Timer for checking if the configuration file change
|
||||
on disk.
|
||||
"""
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
self._parent = parent
|
||||
|
||||
def run(self):
|
||||
self._timer = QtCore.QTimer()
|
||||
self._timer.timeout.connect(self._parent._checkConfigChanged)
|
||||
self._timer.setInterval(1000) # milliseconds
|
||||
self._timer.start()
|
||||
self.exec_()
|
||||
|
||||
|
||||
class LocalConfig(QtCore.QObject):
|
||||
|
||||
"""
|
||||
Handles the local GUI settings.
|
||||
"""
|
||||
|
||||
config_changed_signal = QtCore.Signal()
|
||||
|
||||
def __init__(self, config_file=None):
|
||||
|
||||
super().__init__()
|
||||
self._settings = {}
|
||||
self._last_config_changed = None
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
filename = "gns3_gui.ini"
|
||||
else:
|
||||
filename = "gns3_gui.conf"
|
||||
|
||||
self._migrateOldConfigPath()
|
||||
|
||||
appname = "GNS3"
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
|
||||
# On windows, the system wide configuration file location is %COMMON_APPDATA%/GNS3/gns3_gui.conf
|
||||
common_appdata = os.path.expandvars("%COMMON_APPDATA%")
|
||||
system_wide_config_file = os.path.join(common_appdata, appname, filename)
|
||||
else:
|
||||
# On UNIX-like platforms, the system wide configuration file location is /etc/xdg/GNS3/gns3_gui.conf
|
||||
system_wide_config_file = os.path.join("/etc/xdg", appname, filename)
|
||||
|
||||
if config_file:
|
||||
self._config_file = config_file
|
||||
else:
|
||||
self._config_file = os.path.join(LocalConfig.configDirectory(), filename)
|
||||
|
||||
# First load system wide settings
|
||||
if os.path.exists(system_wide_config_file):
|
||||
self._readConfig(system_wide_config_file)
|
||||
|
||||
config_file_in_cwd = os.path.join(os.getcwd(), filename)
|
||||
if os.path.exists(config_file_in_cwd):
|
||||
# use any config file present in the current working directory
|
||||
self._config_file = config_file_in_cwd
|
||||
elif not os.path.exists(self._config_file):
|
||||
try:
|
||||
# create the config file if it doesn't exist
|
||||
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
|
||||
with open(self._config_file, "w", encoding="utf-8") as f:
|
||||
json.dump({"version": __version__, "type": "settings"}, f)
|
||||
except OSError as e:
|
||||
log.error("Could not create the config file {}: {}".format(self._config_file, e))
|
||||
|
||||
user_settings = self._readConfig(self._config_file)
|
||||
# overwrite system wide settings with user specific ones
|
||||
self._settings.update(user_settings)
|
||||
self._migrateOldConfig()
|
||||
self._writeConfig()
|
||||
|
||||
self._check_thread = PeriodicCheckConfig(self)
|
||||
self._check_thread.start()
|
||||
|
||||
@staticmethod
|
||||
def configDirectory():
|
||||
"""
|
||||
Get the configuration directory
|
||||
"""
|
||||
if sys.platform.startswith("win"):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
path = os.path.join(appdata, "GNS3")
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
path = os.path.join(home, ".config", "GNS3")
|
||||
return os.path.normpath(path)
|
||||
|
||||
def _migrateOldConfigPath(self):
|
||||
"""
|
||||
Migrate pre 1.4 config path
|
||||
"""
|
||||
|
||||
# In < 1.4 on Mac the config was in a gns3.net directory
|
||||
# We have move to same location as Linux
|
||||
if sys.platform.startswith("darwin"):
|
||||
old_path = os.path.join(os.path.expanduser("~"), ".config", "gns3.net")
|
||||
new_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3")
|
||||
if os.path.exists(old_path) and not os.path.exists(new_path):
|
||||
try:
|
||||
shutil.copytree(old_path, new_path)
|
||||
except OSError as e:
|
||||
print("Can't copy the old config: %s", str(e))
|
||||
|
||||
def _migrateOldConfig(self):
|
||||
"""
|
||||
Migrate pre 1.4 config
|
||||
"""
|
||||
|
||||
if "version" not in self._settings or parse_version(self._settings["version"]) < parse_version("1.4.0"):
|
||||
|
||||
servers = self._settings.get("Servers", {})
|
||||
|
||||
if "LocalServer" in self._settings:
|
||||
servers["local_server"] = copy.copy(self._settings["LocalServer"])
|
||||
|
||||
# We migrate the server binary for OSX due to the change from py2app to CX freeze
|
||||
if servers["local_server"]["path"] == "/Applications/GNS3.app/Contents/Resources/server/Contents/MacOS/gns3server":
|
||||
servers["local_server"]["path"] = "/Applications/GNS3.app/Contents/MacOS/gns3server"
|
||||
|
||||
if "RemoteServers" in self._settings:
|
||||
servers["remote_servers"] = copy.copy(self._settings["RemoteServers"])
|
||||
|
||||
self._settings["Servers"] = servers
|
||||
|
||||
if "GUI" in self._settings:
|
||||
main_window = self._settings.get("MainWindow", {})
|
||||
main_window["hide_getting_started_dialog"] = self._settings["GUI"].get("hide_getting_started_dialog", False)
|
||||
self._settings["MainWindow"] = main_window
|
||||
|
||||
def _readConfig(self, config_path):
|
||||
"""
|
||||
Read the configuration file.
|
||||
"""
|
||||
|
||||
log.info("Load config from %s", config_path)
|
||||
try:
|
||||
with open(config_path, "r", encoding="utf-8") as f:
|
||||
self._last_config_changed = os.stat(config_path).st_mtime
|
||||
config = json.load(f)
|
||||
self._settings.update(config)
|
||||
except (ValueError, OSError) as e:
|
||||
log.error("Could not read the config file {}: {}".format(self._config_file, e))
|
||||
|
||||
# Update already loaded section
|
||||
for section in self._settings.keys():
|
||||
if isinstance(self._settings[section], dict):
|
||||
self.loadSectionSettings(section, self._settings[section])
|
||||
|
||||
return dict()
|
||||
|
||||
def _writeConfig(self):
|
||||
"""
|
||||
Write the configuration file.
|
||||
"""
|
||||
|
||||
self._settings["version"] = __version__
|
||||
try:
|
||||
temporary = os.path.join(os.path.dirname(self._config_file), "gns3_gui.tmp")
|
||||
with open(temporary, "w", encoding="utf-8") as f:
|
||||
json.dump(self._settings, f, sort_keys=True, indent=4)
|
||||
shutil.move(temporary, self._config_file)
|
||||
log.info("Configuration save to %s", self._config_file)
|
||||
self._last_config_changed = os.stat(self._config_file).st_mtime
|
||||
except (ValueError, OSError) as e:
|
||||
log.error("Could not write the config file {}: {}".format(self._config_file, e))
|
||||
|
||||
def _checkConfigChanged(self):
|
||||
if self._last_config_changed and self._last_config_changed < os.stat(self._config_file).st_mtime:
|
||||
log.info("Client config has changed, reloading it...")
|
||||
self._readConfig(self._config_file)
|
||||
self.config_changed_signal.emit()
|
||||
|
||||
def configFilePath(self):
|
||||
"""
|
||||
Returns the config file path.
|
||||
|
||||
:returns: path to the config file.
|
||||
"""
|
||||
|
||||
return self._config_file
|
||||
|
||||
def setConfigFilePath(self, config_file):
|
||||
"""
|
||||
Set a new config file
|
||||
|
||||
:returns: path to the config file.
|
||||
"""
|
||||
|
||||
self._config_file = config_file
|
||||
self._readConfig(self._config_file)
|
||||
|
||||
def settings(self):
|
||||
"""
|
||||
Get the settings.
|
||||
|
||||
:returns: settings (dict)
|
||||
"""
|
||||
|
||||
return copy.deepcopy(self._settings)
|
||||
|
||||
def setSettings(self, settings):
|
||||
"""
|
||||
Save the settings.
|
||||
|
||||
:param settings: settings to save (dict)
|
||||
"""
|
||||
|
||||
if self._settings != settings:
|
||||
self._settings.update(settings)
|
||||
self._writeConfig()
|
||||
|
||||
def loadSectionSettings(self, section, default_settings):
|
||||
"""
|
||||
Get all the settings from a given section.
|
||||
|
||||
:param default_settings: setting names and default values (dict)
|
||||
|
||||
:returns: settings (dict)
|
||||
"""
|
||||
|
||||
settings = self.settings().get(section, dict())
|
||||
|
||||
def _copySettings(local, default):
|
||||
"""
|
||||
Copy only existing settings, ignore the other.
|
||||
Add default values if require.
|
||||
"""
|
||||
|
||||
# use default values for missing settings
|
||||
for name, value in default.items():
|
||||
if name not in local:
|
||||
local[name] = value
|
||||
elif isinstance(value, dict):
|
||||
local[name] = _copySettings(local[name], default[name])
|
||||
return local
|
||||
|
||||
settings = _copySettings(settings, default_settings)
|
||||
|
||||
self._settings[section] = settings
|
||||
return copy.deepcopy(settings)
|
||||
|
||||
def saveSectionSettings(self, section, settings):
|
||||
"""
|
||||
Save all the settings in a given section.
|
||||
|
||||
:param section: section name
|
||||
:param settings: settings to save (dict)
|
||||
"""
|
||||
|
||||
if section not in self._settings:
|
||||
self._settings[section] = {}
|
||||
|
||||
if self._settings[section] != settings:
|
||||
self._settings[section].update(settings)
|
||||
log.info("Section %s has changed. Saving configuration", section)
|
||||
self._writeConfig()
|
||||
else:
|
||||
log.debug("Section %s has not changed. Skip saving configuration", section)
|
||||
|
||||
@staticmethod
|
||||
def instance(config_file=None):
|
||||
"""
|
||||
Singleton to return only on instance of LocalConfig.
|
||||
|
||||
:returns: instance of LocalConfig
|
||||
"""
|
||||
|
||||
if not hasattr(LocalConfig, "_instance") or LocalConfig._instance is None:
|
||||
LocalConfig._instance = LocalConfig(config_file=config_file)
|
||||
return LocalConfig._instance
|
||||
140
gns3/local_server_config.py
Normal file
140
gns3/local_server_config.py
Normal file
@@ -0,0 +1,140 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import configparser
|
||||
from gns3.qt import QtCore
|
||||
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LocalServerConfig:
|
||||
|
||||
"""
|
||||
Local server configuration.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
appname = "GNS3"
|
||||
|
||||
self._config = configparser.RawConfigParser()
|
||||
if sys.platform.startswith("win"):
|
||||
filename = "gns3_server.ini"
|
||||
else:
|
||||
filename = "gns3_server.conf"
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
self._config_file = os.path.join(appdata, appname, filename)
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
self._config_file = os.path.join(home, ".config", appname, filename)
|
||||
|
||||
try:
|
||||
# create the config file if it doesn't exist
|
||||
open(self._config_file, "a").close()
|
||||
except OSError as e:
|
||||
log.error("Could not create the local server configuration {}: {}".format(self._config_file, e))
|
||||
self.readConfig()
|
||||
|
||||
def readConfig(self):
|
||||
"""
|
||||
Read the configuration file.
|
||||
"""
|
||||
|
||||
try:
|
||||
self._config.read(self._config_file, encoding="utf-8")
|
||||
except (OSError, configparser.Error) as e:
|
||||
log.error("Could not read the local server configuration {}: {}".format(self._config_file, e))
|
||||
|
||||
def writeConfig(self):
|
||||
"""
|
||||
Write the configuration file.
|
||||
"""
|
||||
|
||||
try:
|
||||
log.debug("Write configuration file %s", self._config_file)
|
||||
with open(self._config_file, "w", encoding="utf-8") as fp:
|
||||
self._config.write(fp)
|
||||
except (OSError, configparser.Error) as e:
|
||||
log.error("Could not write the local server configuration {}: {}".format(self._config_file, e))
|
||||
|
||||
def loadSettings(self, section, default_settings, types):
|
||||
"""
|
||||
Get all the settings from a given section.
|
||||
|
||||
:param section: section name
|
||||
:param default_settings: setting names and default values (dict)
|
||||
:param types: setting types (dict)
|
||||
|
||||
:returns: settings (dict)
|
||||
"""
|
||||
|
||||
if section not in self._config:
|
||||
self._config[section] = {}
|
||||
|
||||
settings = {}
|
||||
for name, default in default_settings.items():
|
||||
if types[name] is int:
|
||||
settings[name] = self._config[section].getint(name, default)
|
||||
elif types[name] is bool:
|
||||
settings[name] = self._config[section].getboolean(name, default)
|
||||
elif types[name] is float:
|
||||
settings[name] = self._config[section].getfloat(name, default)
|
||||
else:
|
||||
settings[name] = self._config[section].get(name, default)
|
||||
|
||||
# sync with the config file
|
||||
self.saveSettings(section, settings)
|
||||
return settings
|
||||
|
||||
def saveSettings(self, section, settings):
|
||||
"""
|
||||
Save all the settings in a given section.
|
||||
|
||||
:param section: section name
|
||||
:param settings: settings to save (dict)
|
||||
"""
|
||||
|
||||
changed = False
|
||||
if section not in self._config:
|
||||
self._config[section] = {}
|
||||
changed = True
|
||||
|
||||
for name, value in settings.items():
|
||||
if name not in self._config[section] or self._config[section][name] != str(value):
|
||||
self._config[section][name] = str(value)
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
self.writeConfig()
|
||||
|
||||
@staticmethod
|
||||
def instance():
|
||||
"""
|
||||
Singleton to return only on instance of LocalServerConfig.
|
||||
|
||||
:returns: instance of Config
|
||||
"""
|
||||
|
||||
if not hasattr(LocalServerConfig, "_instance"):
|
||||
LocalServerConfig._instance = LocalServerConfig()
|
||||
return LocalServerConfig._instance
|
||||
109
gns3/logger.py
Normal file
109
gns3/logger.py
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Provide a pretty logging on console"""
|
||||
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
class ColouredFormatter(logging.Formatter):
|
||||
RESET = '\x1B[0m'
|
||||
RED = '\x1B[31m'
|
||||
YELLOW = '\x1B[33m'
|
||||
GREEN = '\x1B[32m'
|
||||
PINK = '\x1b[35m'
|
||||
|
||||
def format(self, record, colour=False):
|
||||
|
||||
message = super().format(record)
|
||||
|
||||
if not colour or sys.platform.startswith("win"):
|
||||
return message.replace("#RESET#", "")
|
||||
|
||||
level_no = record.levelno
|
||||
if level_no >= logging.CRITICAL:
|
||||
colour = self.RED
|
||||
elif level_no >= logging.ERROR:
|
||||
colour = self.RED
|
||||
elif level_no >= logging.WARNING:
|
||||
colour = self.YELLOW
|
||||
elif level_no >= logging.INFO:
|
||||
colour = self.GREEN
|
||||
elif level_no >= logging.DEBUG:
|
||||
colour = self.PINK
|
||||
else:
|
||||
colour = self.RESET
|
||||
|
||||
message = message.replace("#RESET#", self.RESET)
|
||||
message = '{colour}{message}{reset}'.format(colour=colour, message=message, reset=self.RESET)
|
||||
|
||||
return message
|
||||
|
||||
|
||||
class ColouredStreamHandler(logging.StreamHandler):
|
||||
|
||||
def format(self, record, colour=False):
|
||||
|
||||
if not isinstance(self.formatter, ColouredFormatter):
|
||||
self.formatter = ColouredFormatter()
|
||||
|
||||
return self.formatter.format(record, colour)
|
||||
|
||||
def emit(self, record):
|
||||
|
||||
stream = self.stream
|
||||
try:
|
||||
msg = self.format(record, stream.isatty())
|
||||
stream.write(msg)
|
||||
stream.write(self.terminator)
|
||||
self.flush()
|
||||
# On OSX when frozen flush raise a BrokenPipeError
|
||||
except BrokenPipeError:
|
||||
pass
|
||||
except Exception:
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
def init_logger(level, logfile, quiet=False):
|
||||
if sys.platform.startswith("win"):
|
||||
stream_handler = logging.StreamHandler(sys.stdout)
|
||||
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
|
||||
else:
|
||||
stream_handler = ColouredStreamHandler(sys.stdout)
|
||||
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno}#RESET# {message}", "%Y-%m-%d %H:%M:%S", "{")
|
||||
logging.basicConfig(level=level, handlers=[stream_handler])
|
||||
log = logging.getLogger()
|
||||
log.addHandler(stream_handler)
|
||||
|
||||
try:
|
||||
try:
|
||||
os.makedirs(os.path.dirname(logfile))
|
||||
except FileExistsError:
|
||||
pass
|
||||
handler = logging.FileHandler(logfile, "w")
|
||||
handler.formatter = logging.Formatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
|
||||
log.addHandler(handler)
|
||||
except OSError as e:
|
||||
log.warn("could not log to {}: {}".format(logfile, e))
|
||||
|
||||
log.info('Log level: {}'.format(logging.getLevelName(level)))
|
||||
|
||||
return logging.getLogger()
|
||||
217
gns3/main.py
217
gns3/main.py
@@ -16,24 +16,50 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Try to install updates & restart application if an update is installed
|
||||
try:
|
||||
import gns3.update_manager
|
||||
if gns3.update_manager.UpdateManager().installDownloadedUpdates():
|
||||
print("Update installed restart the application")
|
||||
python = sys.executable
|
||||
os.execl(python, python, * sys.argv)
|
||||
except Exception as e:
|
||||
print("Fail update installation: {}".format(str(e)))
|
||||
|
||||
|
||||
# WARNING
|
||||
# Due to buggy user machines we choose to put this as the first loading modules
|
||||
# otherwise the egg cache is initialized in his standard location and
|
||||
# if is not writetable the application crash. It's the user fault
|
||||
# because one day the user as used sudo to run an egg and break his
|
||||
# filesystem permissions, but it's a common mistake.
|
||||
from gns3.utils.get_resource import get_resource
|
||||
|
||||
|
||||
import datetime
|
||||
import traceback
|
||||
import time
|
||||
import locale
|
||||
import argparse
|
||||
import signal
|
||||
|
||||
try:
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets, DEFAULT_BINDING
|
||||
except ImportError:
|
||||
raise SystemExit("Can't import Qt modules: Qt and/or PyQt is probably not installed correctly...")
|
||||
from gns3.main_window import MainWindow
|
||||
|
||||
from gns3.logger import init_logger
|
||||
from gns3.crash_report import CrashReport
|
||||
from gns3.local_config import LocalConfig
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
try:
|
||||
from gns3.qt import QtCore, QtGui, DEFAULT_BINDING
|
||||
except ImportError:
|
||||
raise RuntimeError("Can't import Qt modules: Qt and/or PyQt is probably not installed correctly...")
|
||||
|
||||
from gns3.main_window import MainWindow
|
||||
from gns3.version import __version__
|
||||
|
||||
|
||||
@@ -81,11 +107,44 @@ def main():
|
||||
Entry point for GNS3 GUI.
|
||||
"""
|
||||
|
||||
# Sometimes (for example at first launch) the OSX app service launcher add
|
||||
# an extra argument starting with -psn_. We filter it
|
||||
if sys.platform.startswith("darwin"):
|
||||
sys.argv = [a for a in sys.argv if not a.startswith("-psn_")]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--version', help="show the version", action='version', version=__version__)
|
||||
parser.add_argument('--debug', help="print out debug messages", action='store_true', default=False)
|
||||
parser.add_argument("project", help="load a GNS3 project (.gns3)", metavar="path", nargs="?")
|
||||
parser.add_argument("--version", help="show the version", action="version", version=__version__)
|
||||
parser.add_argument("--debug", help="print out debug messages", action="store_true", default=False)
|
||||
parser.add_argument("--config", help="Configuration file")
|
||||
options = parser.parse_args()
|
||||
exception_file_path = "exception.log"
|
||||
exception_file_path = "exceptions.log"
|
||||
|
||||
if options.config:
|
||||
LocalConfig.instance(config_file=options.config)
|
||||
else:
|
||||
LocalConfig.instance()
|
||||
|
||||
if hasattr(sys, "frozen"):
|
||||
# We add to the path where the OS search executable our binary location starting by GNS3
|
||||
# packaged binary
|
||||
frozen_dir = os.path.dirname(os.path.abspath(sys.executable))
|
||||
if sys.platform.startswith("darwin"):
|
||||
frozen_dirs = [
|
||||
frozen_dir,
|
||||
os.path.normpath(os.path.join(frozen_dir, '..', 'Resources'))
|
||||
]
|
||||
elif sys.platform.startswith("win"):
|
||||
frozen_dirs = [
|
||||
frozen_dir,
|
||||
os.path.normpath(os.path.join(frozen_dir, 'dynamips')),
|
||||
os.path.normpath(os.path.join(frozen_dir, 'vpcs'))
|
||||
]
|
||||
|
||||
os.environ["PATH"] = os.pathsep.join(frozen_dirs) + os.pathsep + os.environ.get("PATH", "")
|
||||
|
||||
if options.project:
|
||||
os.chdir(frozen_dir)
|
||||
|
||||
def exceptionHook(exception, value, tb):
|
||||
|
||||
@@ -94,22 +153,27 @@ def main():
|
||||
|
||||
lines = traceback.format_exception(exception, value, tb)
|
||||
print("****** Exception detected, traceback information saved in {} ******".format(exception_file_path))
|
||||
print("\nPLEASE REPORT ON https://community.gns3.com/community/support/bug\n")
|
||||
print("\nPLEASE REPORT ON https://community.gns3.com/community/software/bug\n")
|
||||
print("".join(lines))
|
||||
try:
|
||||
curdate = time.strftime("%d %b %Y %H:%M:%S")
|
||||
logfile = open(exception_file_path, "a")
|
||||
logfile = open(exception_file_path, "a", encoding="utf-8")
|
||||
logfile.write("=== GNS3 {} traceback on {} ===\n".format(__version__, curdate))
|
||||
logfile.write("".join(lines))
|
||||
logfile.close()
|
||||
except OSError as e:
|
||||
print("Could not save traceback to {}: {}".format(exception_file_path, e))
|
||||
print("Could not save traceback to {}: {}".format(os.path.normpath(exception_file_path), e))
|
||||
|
||||
if not sys.stdout.isatty():
|
||||
# if stdout is not a tty (redirected to the console view),
|
||||
# then print the exception on stderr too.
|
||||
print("".join(lines), file=sys.stderr)
|
||||
|
||||
if exception is MemoryError:
|
||||
print("YOUR SYSTEM IS OUT OF MEMORY!")
|
||||
else:
|
||||
CrashReport.instance().captureException(exception, value, tb)
|
||||
|
||||
# catch exceptions to write them in a file
|
||||
sys.excepthook = exceptionHook
|
||||
|
||||
@@ -117,30 +181,22 @@ def main():
|
||||
print("GNS3 GUI version {}".format(__version__))
|
||||
print("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
|
||||
|
||||
# we only support Python 2 version >= 2.7 and Python 3 version >= 3.3
|
||||
if sys.version_info < (2, 7):
|
||||
raise RuntimeError("Python 2.7 or higher is required")
|
||||
elif sys.version_info[0] == 3 and sys.version_info < (3, 3):
|
||||
raise RuntimeError("Python 3.3 or higher is required")
|
||||
# we only support Python 3 version >= 3.4
|
||||
if sys.version_info < (3, 4):
|
||||
raise SystemExit("Python 3.4 or higher is required")
|
||||
|
||||
version = lambda version_string: [int(i) for i in version_string.split('.')]
|
||||
def version(version_string):
|
||||
return [int(i) for i in version_string.split('.')]
|
||||
|
||||
if version(QtCore.QT_VERSION_STR) < version("4.6"):
|
||||
raise RuntimeError("Requirement is Qt version 4.6 or higher, got version {}".format(QtCore.QT_VERSION_STR))
|
||||
raise SystemExit("Requirement is Qt version 4.6 or higher, got version {}".format(QtCore.QT_VERSION_STR))
|
||||
|
||||
# 4.8.3 because of QSettings (http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html)
|
||||
if DEFAULT_BINDING == "PyQt" and version(QtCore.BINDING_VERSION_STR) < version("4.8.3"):
|
||||
raise RuntimeError("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
|
||||
if DEFAULT_BINDING == "PyQt4" and version(QtCore.BINDING_VERSION_STR) < version("4.8.3"):
|
||||
raise SystemExit("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
|
||||
|
||||
if DEFAULT_BINDING == "PySide" and version(QtCore.BINDING_VERSION_STR) < version("1.0"):
|
||||
raise RuntimeError("Requirement is PySide version 1.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
|
||||
|
||||
try:
|
||||
# if tornado is present then enable pretty logging.
|
||||
import tornado.log
|
||||
tornado.log.enable_pretty_logging()
|
||||
except ImportError:
|
||||
pass
|
||||
if DEFAULT_BINDING == "PyQt5" and version(QtCore.BINDING_VERSION_STR) < version("5.0.0"):
|
||||
raise SystemExit("Requirement is PyQt5 version 5.0.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
|
||||
|
||||
# check for the correct locale
|
||||
# (UNIX/Linux only)
|
||||
@@ -156,69 +212,62 @@ def main():
|
||||
if sys.platform.startswith('win') or sys.platform.startswith('darwin'):
|
||||
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)
|
||||
|
||||
if sys.platform.startswith('win'):
|
||||
if sys.platform.startswith('win') and hasattr(sys, "frozen"):
|
||||
try:
|
||||
import win32console
|
||||
import win32con
|
||||
import win32gui
|
||||
except ImportError:
|
||||
raise RuntimeError("Python for Windows extensions must be installed.")
|
||||
raise SystemExit("Python for Windows extensions must be installed.")
|
||||
|
||||
try:
|
||||
win32console.AllocConsole()
|
||||
console_window = win32console.GetConsoleWindow()
|
||||
win32gui.ShowWindow(console_window, win32con.SW_HIDE)
|
||||
except win32console.error as e:
|
||||
print("warning: could not allocate console: {}".format(e))
|
||||
|
||||
exit_code = MainWindow.exit_code_reboot
|
||||
while exit_code == MainWindow.exit_code_reboot:
|
||||
|
||||
exit_code = 0
|
||||
app = QtGui.QApplication(sys.argv)
|
||||
|
||||
# this info is necessary for QSettings
|
||||
app.setOrganizationName("GNS3")
|
||||
app.setOrganizationDomain("gns3.net")
|
||||
app.setApplicationName("GNS3")
|
||||
app.setApplicationVersion(__version__)
|
||||
|
||||
# save client logging info to a file
|
||||
logfile = os.path.join(os.path.dirname(QtCore.QSettings().fileName()), "GNS3_client.log") # FIXME: does it work?
|
||||
try:
|
||||
if not options.debug:
|
||||
try:
|
||||
os.makedirs(os.path.dirname(QtCore.QSettings().fileName()))
|
||||
except FileExistsError:
|
||||
pass
|
||||
handler = logging.FileHandler(logfile, "w")
|
||||
if options.debug:
|
||||
root_logger = logging.getLogger()
|
||||
root_logger.setLevel(logging.DEBUG)
|
||||
if len(root_logger.handlers) > 0:
|
||||
root_handler = root_logger.handlers[0]
|
||||
else:
|
||||
root_handler = logging.StreamHandler()
|
||||
root_logger.addHandler(root_handler)
|
||||
root_handler.setLevel(logging.DEBUG)
|
||||
else:
|
||||
handler.setLevel(logging.INFO)
|
||||
log.info('Log level: {}'.format(logging.getLevelName(log.getEffectiveLevel())))
|
||||
# hide the console
|
||||
console_window = win32console.GetConsoleWindow()
|
||||
win32gui.ShowWindow(console_window, win32con.SW_HIDE)
|
||||
except win32console.error as e:
|
||||
print("warning: could not allocate console: {}".format(e))
|
||||
|
||||
formatter = logging.Formatter("[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d] %(message)s",
|
||||
datefmt="%y%m%d %H:%M:%S")
|
||||
handler.setFormatter(formatter)
|
||||
log.addHandler(handler)
|
||||
except OSError as e:
|
||||
log.warn("could not log to {}: {}".format(logfile, e))
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
# update the exception file path to have it in the same directory as the settings file.
|
||||
exception_file_path = os.path.join(os.path.dirname(QtCore.QSettings().fileName()), exception_file_path)
|
||||
# this info is necessary for QSettings
|
||||
app.setOrganizationName("GNS3")
|
||||
app.setOrganizationDomain("gns3.net")
|
||||
app.setApplicationName("GNS3")
|
||||
app.setApplicationVersion(__version__)
|
||||
|
||||
mainwindow = MainWindow.instance()
|
||||
mainwindow.show()
|
||||
exit_code = app.exec_()
|
||||
delattr(MainWindow, "_instance")
|
||||
app.deleteLater()
|
||||
# save client logging info to a file
|
||||
logfile = os.path.join(LocalConfig.configDirectory(), "gns3_gui.log")
|
||||
|
||||
# on debug enable logging to stdout
|
||||
if options.debug:
|
||||
root_logger = init_logger(logging.DEBUG, logfile)
|
||||
else:
|
||||
root_logger = init_logger(logging.INFO, logfile)
|
||||
|
||||
# update the exception file path to have it in the same directory as the settings file.
|
||||
exception_file_path = os.path.join(LocalConfig.configDirectory(), exception_file_path)
|
||||
|
||||
mainwindow = MainWindow(options.project)
|
||||
|
||||
# Manage Ctrl + C or kill command
|
||||
def sigint_handler(*args):
|
||||
log.info("Signal received exiting the application")
|
||||
mainwindow.setSoftExit(False)
|
||||
app.closeAllWindows()
|
||||
signal.signal(signal.SIGINT, sigint_handler)
|
||||
signal.signal(signal.SIGTERM, sigint_handler)
|
||||
|
||||
mainwindow.show()
|
||||
exit_code = app.exec_()
|
||||
delattr(MainWindow, "_instance")
|
||||
app.deleteLater()
|
||||
|
||||
# We force a full garbage collect before exit
|
||||
# for unknow reason otherwise Qt Segfault on OSX in some
|
||||
# conditions
|
||||
import gc
|
||||
gc.collect()
|
||||
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
1148
gns3/main_window.py
1148
gns3/main_window.py
File diff suppressed because it is too large
Load Diff
@@ -21,5 +21,6 @@ from gns3.modules.iou import IOU
|
||||
from gns3.modules.vpcs import VPCS
|
||||
from gns3.modules.virtualbox import VirtualBox
|
||||
from gns3.modules.qemu import Qemu
|
||||
from gns3.modules.vmware import VMware
|
||||
|
||||
MODULES = [Builtin, VPCS, Dynamips, IOU, VirtualBox, Qemu]
|
||||
MODULES = [VPCS, Dynamips, IOU, Qemu, VirtualBox, VMware, Builtin]
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
Built-in module implementation.
|
||||
"""
|
||||
|
||||
import os
|
||||
from gns3.qt import QtGui
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.servers import Servers
|
||||
from ..module import Module
|
||||
from ..module_error import ModuleError
|
||||
@@ -33,62 +32,18 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Builtin(Module):
|
||||
|
||||
"""
|
||||
Built-in module.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Module.__init__(self)
|
||||
super().__init__()
|
||||
|
||||
self._nodes = []
|
||||
self._servers = []
|
||||
|
||||
def setProjectFilesDir(self, path):
|
||||
"""
|
||||
Sets the project files directory path this module.
|
||||
|
||||
:param path: path to the local project files directory
|
||||
"""
|
||||
|
||||
pass # not used by this module
|
||||
|
||||
def setImageFilesDir(self, path):
|
||||
"""
|
||||
Sets the image files directory path this module.
|
||||
|
||||
:param path: path to the local image files directory
|
||||
"""
|
||||
|
||||
pass # not used by this module
|
||||
|
||||
def addServer(self, server):
|
||||
"""
|
||||
Adds a server to be used by this module.
|
||||
|
||||
:param server: WebSocketClient instance
|
||||
"""
|
||||
|
||||
log.info("adding server {}:{} to built-in module".format(server.host, server.port))
|
||||
self._servers.append(server)
|
||||
|
||||
def removeServer(self, server):
|
||||
"""
|
||||
Removes a server from being used by this module.
|
||||
|
||||
:param server: WebSocketClient instance
|
||||
"""
|
||||
|
||||
log.info("removing server {}:{} from built-in module".format(server.host, server.port))
|
||||
self._servers.remove(server)
|
||||
|
||||
def servers(self):
|
||||
"""
|
||||
Returns all the servers used by this module.
|
||||
|
||||
:returns: list of WebSocketClient instances
|
||||
"""
|
||||
|
||||
return self._servers
|
||||
def configChangedSlot(self):
|
||||
pass
|
||||
|
||||
def addNode(self, node):
|
||||
"""
|
||||
@@ -109,13 +64,21 @@ class Builtin(Module):
|
||||
if node in self._nodes:
|
||||
self._nodes.remove(node)
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets the module.
|
||||
"""
|
||||
|
||||
log.info("Built-in module reset")
|
||||
self._nodes.clear()
|
||||
|
||||
def allocateServer(self, node_class):
|
||||
"""
|
||||
Allocates a server.
|
||||
|
||||
:param node_class: Node object
|
||||
|
||||
:returns: allocated server (WebSocketClient instance)
|
||||
:returns: allocated server (HTTPClient instance)
|
||||
"""
|
||||
|
||||
# check all other modules to find if they
|
||||
@@ -133,56 +96,50 @@ class Builtin(Module):
|
||||
servers = Servers.instance()
|
||||
local_server = servers.localServer()
|
||||
remote_servers = servers.remoteServers()
|
||||
gns3_vm = Servers.instance().vmServer()
|
||||
|
||||
if not all(using_local_server) and len(remote_servers):
|
||||
if not all(using_local_server) and (gns3_vm or len(remote_servers)):
|
||||
# a module is not using a local server
|
||||
|
||||
if not True in using_local_server and len(remote_servers) == 1:
|
||||
# no module is using a local server and there is only one
|
||||
# remote server available, so no need to ask the user.
|
||||
return next(iter(servers))
|
||||
server_list = ["Local server ({})".format(local_server.url())]
|
||||
if gns3_vm:
|
||||
server_list.append("GNS3 VM ({})".format(gns3_vm.url()))
|
||||
if len(remote_servers):
|
||||
if True not in using_local_server and len(remote_servers) == 1:
|
||||
# no module is using a local server and there is only one
|
||||
# remote server available, so no need to ask the user.
|
||||
return next(iter(servers))
|
||||
for remote_server in remote_servers:
|
||||
server_list.append("{}".format(remote_server))
|
||||
|
||||
server_list = []
|
||||
server_list.append("Local server ({}:{})".format(local_server.host, local_server.port))
|
||||
for remote_server in remote_servers:
|
||||
server_list.append("{}".format(remote_server))
|
||||
|
||||
#TODO: move this to graphics_view
|
||||
# TODO: move this to graphics_view
|
||||
from gns3.main_window import MainWindow
|
||||
mainwindow = MainWindow.instance()
|
||||
(selection, ok) = QtGui.QInputDialog.getItem(mainwindow, "Server", "Please choose a server", server_list, 0, False)
|
||||
(selection, ok) = QtWidgets.QInputDialog.getItem(mainwindow, "Server", "Please choose a server", server_list, 0, False)
|
||||
if ok:
|
||||
if selection.startswith("Local server"):
|
||||
return local_server
|
||||
elif selection.startswith("GNS3 VM"):
|
||||
return gns3_vm
|
||||
else:
|
||||
return remote_servers[selection]
|
||||
else:
|
||||
raise ModuleError("Please select a server")
|
||||
return local_server
|
||||
|
||||
def createNode(self, node_class, server):
|
||||
def createNode(self, node_class, server, project):
|
||||
"""
|
||||
Creates a new node.
|
||||
|
||||
:param node_class: Node object
|
||||
:param server: WebSocketClient instance
|
||||
:param server: HTTPClient instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
log.info("creating node {}".format(node_class))
|
||||
|
||||
if not server.connected():
|
||||
try:
|
||||
log.info("reconnecting to server {}:{}".format(server.host, server.port))
|
||||
server.reconnect()
|
||||
except OSError as e:
|
||||
raise ModuleError("Could not connect to server {}:{}: {}".format(server.host,
|
||||
server.port,
|
||||
e))
|
||||
if server not in self._servers:
|
||||
self.addServer(server)
|
||||
|
||||
# create an instance of the node class
|
||||
return node_class(self, server)
|
||||
return node_class(self, server, project)
|
||||
|
||||
def setupNode(self, node, node_name):
|
||||
"""
|
||||
@@ -195,13 +152,6 @@ class Builtin(Module):
|
||||
log.info("configuring node {}".format(node))
|
||||
node.setup()
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets the servers.
|
||||
"""
|
||||
|
||||
self._servers.clear()
|
||||
|
||||
@staticmethod
|
||||
def findAlternativeInterface(node, missing_interface):
|
||||
|
||||
@@ -213,13 +163,15 @@ class Builtin(Module):
|
||||
available_interfaces.append(interface["name"])
|
||||
|
||||
if available_interfaces:
|
||||
selection, ok = QtGui.QInputDialog.getItem(mainwindow,
|
||||
"Cloud interfaces", "Interface {} could not be found\nPlease select an alternative from your existing interfaces:".format(missing_interface),
|
||||
available_interfaces, 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(mainwindow,
|
||||
"Cloud interfaces", "Interface {} could not be found\nPlease select an alternative from your existing interfaces:".format(missing_interface),
|
||||
available_interfaces, 0, False)
|
||||
if ok:
|
||||
return selection
|
||||
QtWidgets.QMessageBox.warning(mainwindow, "Cloud interface", "No alternative interface chosen to replace {} on this host, this may lead to issues".format(missing_interface))
|
||||
return None
|
||||
else:
|
||||
QtGui.QMessageBox.critical(mainwindow, "Cloud interface", "Could not find interface {} on this host".format(missing_interface))
|
||||
QtWidgets.QMessageBox.critical(mainwindow, "Cloud interface", "Could not find interface {} on this host".format(missing_interface))
|
||||
return missing_interface
|
||||
|
||||
@staticmethod
|
||||
@@ -256,8 +208,7 @@ class Builtin(Module):
|
||||
{"class": node_class.__name__,
|
||||
"name": node_class.symbolName(),
|
||||
"categories": node_class.categories(),
|
||||
"default_symbol": node_class.defaultSymbol(),
|
||||
"hover_symbol": node_class.hoverSymbol()}
|
||||
"symbol": node_class.defaultSymbol()}
|
||||
)
|
||||
return nodes
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from gns3.node import Node
|
||||
from gns3.ports.port import Port
|
||||
from gns3.nios.nio_generic_ethernet import NIOGenericEthernet
|
||||
from gns3.nios.nio_linux_ethernet import NIOLinuxEthernet
|
||||
from gns3.nios.nio_nat import NIONAT
|
||||
from gns3.nios.nio_udp import NIOUDP
|
||||
from gns3.nios.nio_tap import NIOTAP
|
||||
from gns3.nios.nio_unix import NIOUNIX
|
||||
@@ -36,17 +37,20 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Cloud(Node):
|
||||
|
||||
"""
|
||||
Dynamips cloud.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
_name_instance_count = 1
|
||||
|
||||
def __init__(self, module, server):
|
||||
Node.__init__(self, server)
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
super().__init__(module, server, project)
|
||||
|
||||
log.info("cloud is being created")
|
||||
# create an unique id and name
|
||||
@@ -55,13 +59,10 @@ class Cloud(Node):
|
||||
|
||||
name = "Cloud {}".format(self._name_id)
|
||||
self.setStatus(Node.started) # this is an always-on node
|
||||
self._defaults = {}
|
||||
self._ports = []
|
||||
self._module = module
|
||||
self._initial_settings = None
|
||||
self._settings = {"nios": [],
|
||||
self._settings = {"name": name,
|
||||
"interfaces": {},
|
||||
"name": name}
|
||||
"nios": []}
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
@@ -84,9 +85,10 @@ class Cloud(Node):
|
||||
|
||||
if initial_settings:
|
||||
self._initial_settings = initial_settings
|
||||
self._server.send_message("builtin.interfaces", None, self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False):
|
||||
self._server.get("/interfaces", self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
@@ -150,6 +152,19 @@ class Cloud(Node):
|
||||
return NIOLinuxEthernet(linux_device)
|
||||
return None
|
||||
|
||||
def _createNIONAT(self, nio):
|
||||
"""
|
||||
Creates a NIO NAT.
|
||||
|
||||
:param nio: nio string
|
||||
"""
|
||||
|
||||
match = re.search(r"""^nio_nat:(.+)$""", nio)
|
||||
if match:
|
||||
identifier = match.group(1)
|
||||
return NIONAT(identifier)
|
||||
return None
|
||||
|
||||
def _createNIOTAP(self, nio):
|
||||
"""
|
||||
Creates a NIO TAP.
|
||||
@@ -211,53 +226,57 @@ class Cloud(Node):
|
||||
:param new_settings: settings dictionary
|
||||
"""
|
||||
|
||||
nios = new_settings["nios"]
|
||||
|
||||
updated = False
|
||||
# add ports
|
||||
for nio in nios:
|
||||
if nio in self._settings["nios"]:
|
||||
# port already created for this NIO
|
||||
continue
|
||||
nio_object = None
|
||||
if nio.lower().startswith("nio_udp"):
|
||||
nio_object = self._createNIOUDP(nio)
|
||||
if nio.lower().startswith("nio_gen_eth"):
|
||||
nio_object = self._createNIOGenericEthernet(nio)
|
||||
if nio.lower().startswith("nio_gen_linux"):
|
||||
nio_object = self._createNIOLinuxEthernet(nio)
|
||||
if nio.lower().startswith("nio_tap"):
|
||||
nio_object = self._createNIOTAP(nio)
|
||||
if nio.lower().startswith("nio_unix"):
|
||||
nio_object = self._createNIOUNIX(nio)
|
||||
if nio.lower().startswith("nio_vde"):
|
||||
nio_object = self._createNIOVDE(nio)
|
||||
if nio.lower().startswith("nio_null"):
|
||||
nio_object = self._createNIONull(nio)
|
||||
if nio_object == None:
|
||||
log.error("Could not create NIO object from {}".format(nio))
|
||||
continue
|
||||
port = Port(nio, nio_object, stub=True)
|
||||
port.setStatus(Port.started)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(nio))
|
||||
if "nios" in new_settings:
|
||||
nios = new_settings["nios"]
|
||||
|
||||
# delete ports
|
||||
for nio in self._settings["nios"]:
|
||||
if nio not in nios:
|
||||
for port in self._ports.copy():
|
||||
if port.name() == nio:
|
||||
self._ports.remove(port)
|
||||
updated = True
|
||||
log.debug("port {} has been deleted".format(nio))
|
||||
break
|
||||
# add ports
|
||||
for nio in nios:
|
||||
if nio in self._settings["nios"]:
|
||||
# port already created for this NIO
|
||||
continue
|
||||
nio_object = None
|
||||
if nio.lower().startswith("nio_udp"):
|
||||
nio_object = self._createNIOUDP(nio)
|
||||
if nio.lower().startswith("nio_gen_eth"):
|
||||
nio_object = self._createNIOGenericEthernet(nio)
|
||||
if nio.lower().startswith("nio_gen_linux"):
|
||||
nio_object = self._createNIOLinuxEthernet(nio)
|
||||
if nio.lower().startswith("nio_nat"):
|
||||
nio_object = self._createNIONAT(nio)
|
||||
if nio.lower().startswith("nio_tap"):
|
||||
nio_object = self._createNIOTAP(nio)
|
||||
if nio.lower().startswith("nio_unix"):
|
||||
nio_object = self._createNIOUNIX(nio)
|
||||
if nio.lower().startswith("nio_vde"):
|
||||
nio_object = self._createNIOVDE(nio)
|
||||
if nio.lower().startswith("nio_null"):
|
||||
nio_object = self._createNIONull(nio)
|
||||
if nio_object is None:
|
||||
log.error("Could not create NIO object from {}".format(nio))
|
||||
continue
|
||||
port = Port(nio, nio_object, stub=True)
|
||||
port.setStatus(Port.started)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(nio))
|
||||
|
||||
# delete ports
|
||||
for nio in self._settings["nios"]:
|
||||
if nio not in nios:
|
||||
for port in self._ports.copy():
|
||||
if port.name() == nio:
|
||||
self._ports.remove(port)
|
||||
updated = True
|
||||
log.debug("port {} has been deleted".format(nio))
|
||||
break
|
||||
|
||||
self._settings["nios"] = new_settings["nios"].copy()
|
||||
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
self._settings["name"] = new_settings["name"]
|
||||
updated = True
|
||||
|
||||
self._settings["nios"] = new_settings["nios"].copy()
|
||||
if updated:
|
||||
log.info("cloud {} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
@@ -309,7 +328,7 @@ This is a pseudo-device for external connections
|
||||
"properties": {"name": self.name(),
|
||||
"nios": self._settings["nios"]},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
}
|
||||
|
||||
# add the ports
|
||||
if self._ports:
|
||||
@@ -327,11 +346,11 @@ This is a pseudo-device for external connections
|
||||
:param node_info: representation of the node (dictionary)
|
||||
"""
|
||||
|
||||
self.node_info = node_info
|
||||
settings = node_info["properties"]
|
||||
name = settings.pop("name")
|
||||
self.updated_signal.connect(self._updatePortSettings)
|
||||
log.info("cloud {} is loading".format(name))
|
||||
self._node_info = node_info
|
||||
self.setup(name, settings)
|
||||
|
||||
def _updatePortSettings(self):
|
||||
@@ -341,8 +360,8 @@ This is a pseudo-device for external connections
|
||||
|
||||
self.updated_signal.disconnect(self._updatePortSettings)
|
||||
# update the port with the correct IDs
|
||||
if "ports" in self.node_info:
|
||||
ports = self.node_info["ports"]
|
||||
if "ports" in self._node_info:
|
||||
ports = self._node_info["ports"]
|
||||
for topology_port in ports:
|
||||
for port in self._ports:
|
||||
if topology_port["name"] == port.name():
|
||||
@@ -357,11 +376,12 @@ This is a pseudo-device for external connections
|
||||
break
|
||||
if not available_interface:
|
||||
alternative_interface = self._module.findAlternativeInterface(self, topology_port_name)
|
||||
if topology_port["name"] in self._settings["nios"]:
|
||||
self._settings["nios"].remove(topology_port["name"])
|
||||
topology_port["name"] = topology_port["name"].replace(topology_port_name, alternative_interface)
|
||||
port.setName(topology_port["name"])
|
||||
self._settings["nios"].append(topology_port["name"])
|
||||
if alternative_interface:
|
||||
if topology_port["name"] in self._settings["nios"]:
|
||||
self._settings["nios"].remove(topology_port["name"])
|
||||
topology_port["name"] = topology_port["name"].replace(topology_port_name, alternative_interface)
|
||||
port.setName(topology_port["name"])
|
||||
self._settings["nios"].append(topology_port["name"])
|
||||
|
||||
log.info("cloud {} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
@@ -396,7 +416,7 @@ This is a pseudo-device for external connections
|
||||
|
||||
def configPage(self):
|
||||
"""
|
||||
Returns the configuration page widget to be used by the node configurator.
|
||||
Returns the configuration page widget to be used by the node properties dialog.
|
||||
|
||||
:returns: QWidget object
|
||||
"""
|
||||
@@ -412,17 +432,7 @@ This is a pseudo-device for external connections
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/cloud.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when the cloud is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/cloud.selected.svg"
|
||||
return ":/symbols/cloud.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
@@ -24,27 +24,44 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Host(Cloud):
|
||||
|
||||
"""
|
||||
Pseudo host based on a Dynamips Cloud.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
_name_instance_count = 1
|
||||
|
||||
def __init__(self, module, server):
|
||||
Cloud.__init__(self, module, server)
|
||||
def __init__(self, module, server, project):
|
||||
super().__init__(module, server, project)
|
||||
|
||||
log.info("host is being created")
|
||||
# create an unique id and name
|
||||
self._name_id = Host._name_instance_count
|
||||
Host._name_instance_count += 1
|
||||
|
||||
name = "Host {}".format(self._name_id)
|
||||
name = "Host{}".format(self._name_id)
|
||||
self._settings["name"] = name
|
||||
|
||||
self.created_signal.connect(self._autoConfigure)
|
||||
def setup(self, name=None, initial_settings={}):
|
||||
"""
|
||||
Setups this host.
|
||||
|
||||
:param name: optional name for this host
|
||||
"""
|
||||
|
||||
if name:
|
||||
self._settings["name"] = name
|
||||
|
||||
if initial_settings:
|
||||
self._initial_settings = initial_settings
|
||||
else:
|
||||
self.created_signal.connect(self._autoConfigure)
|
||||
|
||||
self._server.get("/interfaces", self._setupCallback)
|
||||
|
||||
def _autoConfigure(self, node_id):
|
||||
"""
|
||||
@@ -70,17 +87,7 @@ class Host(Cloud):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/computer.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when the host is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/computer.selected.svg"
|
||||
return ":/symbols/computer.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
@@ -20,18 +20,19 @@ Configuration page for clouds.
|
||||
"""
|
||||
|
||||
import re
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.cloud_configuration_page_ui import Ui_cloudConfigPageWidget
|
||||
|
||||
|
||||
class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for clouds.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self._nios = []
|
||||
|
||||
@@ -47,6 +48,12 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
self.uiAddLinuxEthernetPushButton.clicked.connect(self._linuxEthernetAddSlot)
|
||||
self.uiDeleteLinuxEthernetPushButton.clicked.connect(self._linuxEthernetDeleteSlot)
|
||||
|
||||
# connect NIO NAT slots
|
||||
self.uiNIONATListWidget.currentRowChanged.connect(self._NIONATSelectedSlot)
|
||||
self.uiNIONATListWidget.itemSelectionChanged.connect(self._NIONATChangedSlot)
|
||||
self.uiAddNIONATPushButton.clicked.connect(self._NIONATAddSlot)
|
||||
self.uiDeleteNIONATPushButton.clicked.connect(self._NIONATDeleteSlot)
|
||||
|
||||
# connect NIO UDP slots
|
||||
self.uiNIOUDPListWidget.currentRowChanged.connect(self._NIOUDPSelectedSlot)
|
||||
self.uiNIOUDPListWidget.itemSelectionChanged.connect(self._NIOUDPChangedSlot)
|
||||
@@ -105,7 +112,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
interface = self.uiGenericEthernetLineEdit.text()
|
||||
if interface:
|
||||
nio = "nio_gen_eth:{interface}".format(interface=interface)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiGenericEthernetListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -121,7 +128,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiGenericEthernetListWidget.takeItem(self.uiGenericEthernetListWidget.currentRow())
|
||||
@@ -154,7 +161,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
interface = self.uiLinuxEthernetLineEdit.text()
|
||||
if interface:
|
||||
nio = "nio_gen_linux:{interface}".format(interface=interface)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiLinuxEthernetListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -170,14 +177,70 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiLinuxEthernetListWidget.takeItem(self.uiLinuxEthernetListWidget.currentRow())
|
||||
|
||||
def _NIONATSelectedSlot(self, index):
|
||||
"""
|
||||
Loads a selected NAT NIO.
|
||||
|
||||
:param index: ignored
|
||||
"""
|
||||
|
||||
item = self.uiNIONATListWidget.currentItem()
|
||||
if item:
|
||||
nio = item.text()
|
||||
match = re.search(r"""^nio_nat:(.+)$""", nio)
|
||||
if match:
|
||||
self.uiNIONATIdentiferLineEdit.setText(match.group(1))
|
||||
|
||||
def _NIONATChangedSlot(self):
|
||||
"""
|
||||
Enables the use of the delete button.
|
||||
"""
|
||||
|
||||
item = self.uiNIONATListWidget.currentItem()
|
||||
if item:
|
||||
self.uiDeleteNIONATPushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeleteNIONATPushButton.setEnabled(False)
|
||||
|
||||
def _NIONATAddSlot(self):
|
||||
"""
|
||||
Adds a new NAT NIO.
|
||||
"""
|
||||
|
||||
identifier = self.uiNIONATIdentiferLineEdit.text()
|
||||
if identifier:
|
||||
nio = "nio_nat:{}".format(identifier)
|
||||
if nio not in self._nios:
|
||||
self.uiNIONATListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
def _NIONATDeleteSlot(self):
|
||||
"""
|
||||
Deletes a NAT NIO.
|
||||
"""
|
||||
|
||||
item = self.uiNIONATListWidget.currentItem()
|
||||
if item:
|
||||
nio = item.text()
|
||||
# check we can delete that NIO
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIONATListWidget.takeItem(self.uiNIONATListWidget.currentRow())
|
||||
|
||||
def _NIOUDPSelectedSlot(self, index):
|
||||
"""
|
||||
Loads a selected UDP.
|
||||
|
||||
:param index: ignored
|
||||
"""
|
||||
|
||||
item = self.uiNIOUDPListWidget.currentItem()
|
||||
@@ -212,7 +275,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
nio = "nio_udp:{lport}:{rhost}:{rport}".format(lport=local_port,
|
||||
rhost=remote_host,
|
||||
rport=remote_port)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOUDPListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
self.uiLocalPortSpinBox.setValue(local_port + 1)
|
||||
@@ -230,7 +293,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIOUDPListWidget.takeItem(self.uiNIOUDPListWidget.currentRow())
|
||||
@@ -268,7 +331,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
tap_interface = self.uiNIOTAPLineEdit.text()
|
||||
if tap_interface:
|
||||
nio = "nio_tap:{}".format(tap_interface.lower())
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOTAPListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -284,7 +347,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIOTAPListWidget.takeItem(self.uiNIOTAPListWidget.currentRow())
|
||||
@@ -325,7 +388,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
if local_file and remote_file:
|
||||
nio = "nio_unix:{local}:{remote}".format(local=local_file,
|
||||
remote=remote_file)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOUNIXListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -341,7 +404,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIOUNIXListWidget.takeItem(self.uiNIOUNIXListWidget.currentRow())
|
||||
@@ -381,7 +444,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
local_file = self.uiVDELocalFileLineEdit.text()
|
||||
if local_file and control_file:
|
||||
nio = "nio_vde:{control}:{local}".format(control=control_file, local=local_file)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOVDEListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -397,7 +460,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIOVDEListWidget.takeItem(self.uiNIOVDEListWidget.currentRow())
|
||||
@@ -405,6 +468,8 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
def _NIONullSelectedSlot(self, index):
|
||||
"""
|
||||
Loads a selected NULL NIO.
|
||||
|
||||
:param index: ignored
|
||||
"""
|
||||
|
||||
item = self.uiNIONullListWidget.currentItem()
|
||||
@@ -433,7 +498,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
identifier = self.uiNIONullIdentiferLineEdit.text()
|
||||
if identifier:
|
||||
nio = "nio_null:{}".format(identifier)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIONullListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -449,7 +514,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.name() == nio and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
|
||||
return
|
||||
self._nios.remove(nio)
|
||||
self.uiNIONullListWidget.takeItem(self.uiNIONullListWidget.currentRow())
|
||||
@@ -480,7 +545,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
self.uiGenericEthernetComboBox.addItem(interface["name"])
|
||||
self.uiGenericEthernetComboBox.setItemData(index, interface["id"], QtCore.Qt.ToolTipRole)
|
||||
index += 1
|
||||
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||
|
||||
# load all network interfaces
|
||||
self.uiLinuxEthernetComboBox.clear()
|
||||
@@ -490,7 +555,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
self.uiLinuxEthernetComboBox.addItem(interface["name"])
|
||||
self.uiLinuxEthernetComboBox.setItemData(index, interface["id"], QtCore.Qt.ToolTipRole)
|
||||
index += 1
|
||||
self.uiLinuxEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.uiLinuxEthernetComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||
|
||||
# populate the NIO lists
|
||||
self.nios = []
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>542</width>
|
||||
<height>500</height>
|
||||
<width>653</width>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -15,13 +15,13 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="QTabWidget" name="uiNIOsTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<widget class="QWidget" name="NIOEthernetTab">
|
||||
<attribute name="title">
|
||||
<string>NIO Ethernet</string>
|
||||
<string>Ethernet</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
@@ -135,9 +135,104 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="NIONATTab">
|
||||
<attribute name="title">
|
||||
<string>NIO UDP</string>
|
||||
<string>NAT</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="uiNIONATSettingsGroupBox">
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="uiNIONATIdentifierLabel">
|
||||
<property name="text">
|
||||
<string>Local identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="uiNIONATIdentiferLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="3">
|
||||
<widget class="QGroupBox" name="uiNIONATListGroupBox">
|
||||
<property name="title">
|
||||
<string>NIOs</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_3">
|
||||
<item>
|
||||
<widget class="QListWidget" name="uiNIONATListWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="uiAddNIONATPushButton">
|
||||
<property name="text">
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="uiDeleteNIONATPushButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="2">
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>294</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="spacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>194</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="NIOUDPTab">
|
||||
<attribute name="title">
|
||||
<string>UDP</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -265,9 +360,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<widget class="QWidget" name="NIOTAPTab">
|
||||
<attribute name="title">
|
||||
<string>NIO TAP</string>
|
||||
<string>TAP</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
@@ -317,9 +412,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<widget class="QWidget" name="NIOUnixTab">
|
||||
<attribute name="title">
|
||||
<string>NIO UNIX</string>
|
||||
<string>UNIX</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -440,9 +535,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<widget class="QWidget" name="NIOVDETab">
|
||||
<attribute name="title">
|
||||
<string>NIO VDE</string>
|
||||
<string>VDE</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -563,9 +658,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<widget class="QWidget" name="NIONullTab">
|
||||
<attribute name="title">
|
||||
<string>NIO NULL</string>
|
||||
<string>NULL</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -575,9 +670,9 @@
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<widget class="QLabel" name="uiNIONullIdentifierLabel">
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
<string>Local identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -658,7 +753,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<widget class="QWidget" name="MiscTab">
|
||||
<attribute name="title">
|
||||
<string>Misc.</string>
|
||||
</attribute>
|
||||
|
||||
@@ -1,421 +1,459 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/cloud_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/builtin/ui/cloud_configuration_page.ui'
|
||||
#
|
||||
# Created: Mon Mar 17 17:42:16 2014
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Wed Jul 15 12:22:31 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_cloudConfigPageWidget(object):
|
||||
def setupUi(self, cloudConfigPageWidget):
|
||||
cloudConfigPageWidget.setObjectName(_fromUtf8("cloudConfigPageWidget"))
|
||||
cloudConfigPageWidget.resize(542, 500)
|
||||
self.vboxlayout = QtGui.QVBoxLayout(cloudConfigPageWidget)
|
||||
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
|
||||
self.tabWidget = QtGui.QTabWidget(cloudConfigPageWidget)
|
||||
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
|
||||
self.tab = QtGui.QWidget()
|
||||
self.tab.setObjectName(_fromUtf8("tab"))
|
||||
self.vboxlayout1 = QtGui.QVBoxLayout(self.tab)
|
||||
self.vboxlayout1.setObjectName(_fromUtf8("vboxlayout1"))
|
||||
self.uiGenericEthernetGroupBox = QtGui.QGroupBox(self.tab)
|
||||
self.uiGenericEthernetGroupBox.setObjectName(_fromUtf8("uiGenericEthernetGroupBox"))
|
||||
self.gridlayout = QtGui.QGridLayout(self.uiGenericEthernetGroupBox)
|
||||
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
|
||||
self.uiGenericEthernetComboBox = QtGui.QComboBox(self.uiGenericEthernetGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
cloudConfigPageWidget.setObjectName("cloudConfigPageWidget")
|
||||
cloudConfigPageWidget.resize(653, 478)
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(cloudConfigPageWidget)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiNIOsTabWidget = QtWidgets.QTabWidget(cloudConfigPageWidget)
|
||||
self.uiNIOsTabWidget.setObjectName("uiNIOsTabWidget")
|
||||
self.NIOEthernetTab = QtWidgets.QWidget()
|
||||
self.NIOEthernetTab.setObjectName("NIOEthernetTab")
|
||||
self.vboxlayout1 = QtWidgets.QVBoxLayout(self.NIOEthernetTab)
|
||||
self.vboxlayout1.setObjectName("vboxlayout1")
|
||||
self.uiGenericEthernetGroupBox = QtWidgets.QGroupBox(self.NIOEthernetTab)
|
||||
self.uiGenericEthernetGroupBox.setObjectName("uiGenericEthernetGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiGenericEthernetGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiGenericEthernetComboBox = QtWidgets.QComboBox(self.uiGenericEthernetGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiGenericEthernetComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiGenericEthernetComboBox.setSizePolicy(sizePolicy)
|
||||
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
||||
self.uiGenericEthernetComboBox.setObjectName(_fromUtf8("uiGenericEthernetComboBox"))
|
||||
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||
self.uiGenericEthernetComboBox.setObjectName("uiGenericEthernetComboBox")
|
||||
self.gridlayout.addWidget(self.uiGenericEthernetComboBox, 0, 0, 1, 3)
|
||||
self.uiGenericEthernetLineEdit = QtGui.QLineEdit(self.uiGenericEthernetGroupBox)
|
||||
self.uiGenericEthernetLineEdit.setObjectName(_fromUtf8("uiGenericEthernetLineEdit"))
|
||||
self.uiGenericEthernetLineEdit = QtWidgets.QLineEdit(self.uiGenericEthernetGroupBox)
|
||||
self.uiGenericEthernetLineEdit.setObjectName("uiGenericEthernetLineEdit")
|
||||
self.gridlayout.addWidget(self.uiGenericEthernetLineEdit, 1, 0, 1, 1)
|
||||
self.uiAddGenericEthernetPushButton = QtGui.QPushButton(self.uiGenericEthernetGroupBox)
|
||||
self.uiAddGenericEthernetPushButton.setObjectName(_fromUtf8("uiAddGenericEthernetPushButton"))
|
||||
self.uiAddGenericEthernetPushButton = QtWidgets.QPushButton(self.uiGenericEthernetGroupBox)
|
||||
self.uiAddGenericEthernetPushButton.setObjectName("uiAddGenericEthernetPushButton")
|
||||
self.gridlayout.addWidget(self.uiAddGenericEthernetPushButton, 1, 1, 1, 1)
|
||||
self.uiDeleteGenericEthernetPushButton = QtGui.QPushButton(self.uiGenericEthernetGroupBox)
|
||||
self.uiDeleteGenericEthernetPushButton = QtWidgets.QPushButton(self.uiGenericEthernetGroupBox)
|
||||
self.uiDeleteGenericEthernetPushButton.setEnabled(False)
|
||||
self.uiDeleteGenericEthernetPushButton.setObjectName(_fromUtf8("uiDeleteGenericEthernetPushButton"))
|
||||
self.uiDeleteGenericEthernetPushButton.setObjectName("uiDeleteGenericEthernetPushButton")
|
||||
self.gridlayout.addWidget(self.uiDeleteGenericEthernetPushButton, 1, 2, 1, 1)
|
||||
self.uiGenericEthernetListWidget = QtGui.QListWidget(self.uiGenericEthernetGroupBox)
|
||||
self.uiGenericEthernetListWidget.setObjectName(_fromUtf8("uiGenericEthernetListWidget"))
|
||||
self.uiGenericEthernetListWidget = QtWidgets.QListWidget(self.uiGenericEthernetGroupBox)
|
||||
self.uiGenericEthernetListWidget.setObjectName("uiGenericEthernetListWidget")
|
||||
self.gridlayout.addWidget(self.uiGenericEthernetListWidget, 2, 0, 1, 3)
|
||||
self.vboxlayout1.addWidget(self.uiGenericEthernetGroupBox)
|
||||
self.uiLinuxEthernetGroupBox = QtGui.QGroupBox(self.tab)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||
self.uiLinuxEthernetGroupBox = QtWidgets.QGroupBox(self.NIOEthernetTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiLinuxEthernetGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiLinuxEthernetGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiLinuxEthernetGroupBox.setObjectName(_fromUtf8("uiLinuxEthernetGroupBox"))
|
||||
self.gridlayout1 = QtGui.QGridLayout(self.uiLinuxEthernetGroupBox)
|
||||
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
|
||||
self.uiLinuxEthernetComboBox = QtGui.QComboBox(self.uiLinuxEthernetGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiLinuxEthernetGroupBox.setObjectName("uiLinuxEthernetGroupBox")
|
||||
self.gridlayout1 = QtWidgets.QGridLayout(self.uiLinuxEthernetGroupBox)
|
||||
self.gridlayout1.setObjectName("gridlayout1")
|
||||
self.uiLinuxEthernetComboBox = QtWidgets.QComboBox(self.uiLinuxEthernetGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiLinuxEthernetComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiLinuxEthernetComboBox.setSizePolicy(sizePolicy)
|
||||
self.uiLinuxEthernetComboBox.setObjectName(_fromUtf8("uiLinuxEthernetComboBox"))
|
||||
self.uiLinuxEthernetComboBox.setObjectName("uiLinuxEthernetComboBox")
|
||||
self.gridlayout1.addWidget(self.uiLinuxEthernetComboBox, 0, 0, 1, 3)
|
||||
self.uiLinuxEthernetLineEdit = QtGui.QLineEdit(self.uiLinuxEthernetGroupBox)
|
||||
self.uiLinuxEthernetLineEdit.setObjectName(_fromUtf8("uiLinuxEthernetLineEdit"))
|
||||
self.uiLinuxEthernetLineEdit = QtWidgets.QLineEdit(self.uiLinuxEthernetGroupBox)
|
||||
self.uiLinuxEthernetLineEdit.setObjectName("uiLinuxEthernetLineEdit")
|
||||
self.gridlayout1.addWidget(self.uiLinuxEthernetLineEdit, 1, 0, 1, 1)
|
||||
self.uiAddLinuxEthernetPushButton = QtGui.QPushButton(self.uiLinuxEthernetGroupBox)
|
||||
self.uiAddLinuxEthernetPushButton.setObjectName(_fromUtf8("uiAddLinuxEthernetPushButton"))
|
||||
self.uiAddLinuxEthernetPushButton = QtWidgets.QPushButton(self.uiLinuxEthernetGroupBox)
|
||||
self.uiAddLinuxEthernetPushButton.setObjectName("uiAddLinuxEthernetPushButton")
|
||||
self.gridlayout1.addWidget(self.uiAddLinuxEthernetPushButton, 1, 1, 1, 1)
|
||||
self.uiDeleteLinuxEthernetPushButton = QtGui.QPushButton(self.uiLinuxEthernetGroupBox)
|
||||
self.uiDeleteLinuxEthernetPushButton = QtWidgets.QPushButton(self.uiLinuxEthernetGroupBox)
|
||||
self.uiDeleteLinuxEthernetPushButton.setEnabled(False)
|
||||
self.uiDeleteLinuxEthernetPushButton.setObjectName(_fromUtf8("uiDeleteLinuxEthernetPushButton"))
|
||||
self.uiDeleteLinuxEthernetPushButton.setObjectName("uiDeleteLinuxEthernetPushButton")
|
||||
self.gridlayout1.addWidget(self.uiDeleteLinuxEthernetPushButton, 1, 2, 1, 1)
|
||||
self.uiLinuxEthernetListWidget = QtGui.QListWidget(self.uiLinuxEthernetGroupBox)
|
||||
self.uiLinuxEthernetListWidget.setObjectName(_fromUtf8("uiLinuxEthernetListWidget"))
|
||||
self.uiLinuxEthernetListWidget = QtWidgets.QListWidget(self.uiLinuxEthernetGroupBox)
|
||||
self.uiLinuxEthernetListWidget.setObjectName("uiLinuxEthernetListWidget")
|
||||
self.gridlayout1.addWidget(self.uiLinuxEthernetListWidget, 2, 0, 1, 3)
|
||||
self.vboxlayout1.addWidget(self.uiLinuxEthernetGroupBox)
|
||||
spacerItem = QtGui.QSpacerItem(21, 16, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
spacerItem = QtWidgets.QSpacerItem(21, 16, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.vboxlayout1.addItem(spacerItem)
|
||||
self.tabWidget.addTab(self.tab, _fromUtf8(""))
|
||||
self.tab_2 = QtGui.QWidget()
|
||||
self.tab_2.setObjectName(_fromUtf8("tab_2"))
|
||||
self.gridlayout2 = QtGui.QGridLayout(self.tab_2)
|
||||
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
|
||||
self.uiNIOUDPSettingsGroupBox = QtGui.QGroupBox(self.tab_2)
|
||||
self.uiNIOUDPSettingsGroupBox.setObjectName(_fromUtf8("uiNIOUDPSettingsGroupBox"))
|
||||
self.gridlayout3 = QtGui.QGridLayout(self.uiNIOUDPSettingsGroupBox)
|
||||
self.gridlayout3.setObjectName(_fromUtf8("gridlayout3"))
|
||||
self.uiLocalPortLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiLocalPortLabel.setObjectName(_fromUtf8("uiLocalPortLabel"))
|
||||
self.uiNIOsTabWidget.addTab(self.NIOEthernetTab, "")
|
||||
self.NIONATTab = QtWidgets.QWidget()
|
||||
self.NIONATTab.setObjectName("NIONATTab")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.NIONATTab)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiNIONATSettingsGroupBox = QtWidgets.QGroupBox(self.NIONATTab)
|
||||
self.uiNIONATSettingsGroupBox.setObjectName("uiNIONATSettingsGroupBox")
|
||||
self._2 = QtWidgets.QGridLayout(self.uiNIONATSettingsGroupBox)
|
||||
self._2.setObjectName("_2")
|
||||
self.uiNIONATIdentifierLabel = QtWidgets.QLabel(self.uiNIONATSettingsGroupBox)
|
||||
self.uiNIONATIdentifierLabel.setObjectName("uiNIONATIdentifierLabel")
|
||||
self._2.addWidget(self.uiNIONATIdentifierLabel, 0, 0, 1, 1)
|
||||
self.uiNIONATIdentiferLineEdit = QtWidgets.QLineEdit(self.uiNIONATSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIONATIdentiferLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIONATIdentiferLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiNIONATIdentiferLineEdit.setObjectName("uiNIONATIdentiferLineEdit")
|
||||
self._2.addWidget(self.uiNIONATIdentiferLineEdit, 1, 0, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiNIONATSettingsGroupBox, 0, 0, 1, 2)
|
||||
self.uiNIONATListGroupBox = QtWidgets.QGroupBox(self.NIONATTab)
|
||||
self.uiNIONATListGroupBox.setObjectName("uiNIONATListGroupBox")
|
||||
self._3 = QtWidgets.QVBoxLayout(self.uiNIONATListGroupBox)
|
||||
self._3.setObjectName("_3")
|
||||
self.uiNIONATListWidget = QtWidgets.QListWidget(self.uiNIONATListGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIONATListWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIONATListWidget.setSizePolicy(sizePolicy)
|
||||
self.uiNIONATListWidget.setObjectName("uiNIONATListWidget")
|
||||
self._3.addWidget(self.uiNIONATListWidget)
|
||||
self.gridLayout_2.addWidget(self.uiNIONATListGroupBox, 0, 2, 3, 1)
|
||||
self.uiAddNIONATPushButton = QtWidgets.QPushButton(self.NIONATTab)
|
||||
self.uiAddNIONATPushButton.setObjectName("uiAddNIONATPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddNIONATPushButton, 1, 0, 1, 1)
|
||||
self.uiDeleteNIONATPushButton = QtWidgets.QPushButton(self.NIONATTab)
|
||||
self.uiDeleteNIONATPushButton.setEnabled(False)
|
||||
self.uiDeleteNIONATPushButton.setObjectName("uiDeleteNIONATPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeleteNIONATPushButton, 1, 1, 1, 1)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 294, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem1, 2, 0, 2, 1)
|
||||
spacerItem2 = QtWidgets.QSpacerItem(20, 194, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem2, 3, 2, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.NIONATTab, "")
|
||||
self.NIOUDPTab = QtWidgets.QWidget()
|
||||
self.NIOUDPTab.setObjectName("NIOUDPTab")
|
||||
self.gridlayout2 = QtWidgets.QGridLayout(self.NIOUDPTab)
|
||||
self.gridlayout2.setObjectName("gridlayout2")
|
||||
self.uiNIOUDPSettingsGroupBox = QtWidgets.QGroupBox(self.NIOUDPTab)
|
||||
self.uiNIOUDPSettingsGroupBox.setObjectName("uiNIOUDPSettingsGroupBox")
|
||||
self.gridlayout3 = QtWidgets.QGridLayout(self.uiNIOUDPSettingsGroupBox)
|
||||
self.gridlayout3.setObjectName("gridlayout3")
|
||||
self.uiLocalPortLabel = QtWidgets.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiLocalPortLabel.setObjectName("uiLocalPortLabel")
|
||||
self.gridlayout3.addWidget(self.uiLocalPortLabel, 0, 0, 1, 1)
|
||||
self.uiLocalPortSpinBox = QtGui.QSpinBox(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiLocalPortSpinBox = QtWidgets.QSpinBox(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiLocalPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiLocalPortSpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiLocalPortSpinBox.setMaximum(65535)
|
||||
self.uiLocalPortSpinBox.setProperty("value", 30000)
|
||||
self.uiLocalPortSpinBox.setObjectName(_fromUtf8("uiLocalPortSpinBox"))
|
||||
self.uiLocalPortSpinBox.setObjectName("uiLocalPortSpinBox")
|
||||
self.gridlayout3.addWidget(self.uiLocalPortSpinBox, 0, 1, 1, 1)
|
||||
self.uiRemoteHostLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiRemoteHostLabel.setObjectName(_fromUtf8("uiRemoteHostLabel"))
|
||||
self.uiRemoteHostLabel = QtWidgets.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiRemoteHostLabel.setObjectName("uiRemoteHostLabel")
|
||||
self.gridlayout3.addWidget(self.uiRemoteHostLabel, 1, 0, 1, 1)
|
||||
self.uiRemoteHostLineEdit = QtGui.QLineEdit(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiRemoteHostLineEdit = QtWidgets.QLineEdit(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteHostLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiRemoteHostLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiRemoteHostLineEdit.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.uiRemoteHostLineEdit.setObjectName(_fromUtf8("uiRemoteHostLineEdit"))
|
||||
self.uiRemoteHostLineEdit.setObjectName("uiRemoteHostLineEdit")
|
||||
self.gridlayout3.addWidget(self.uiRemoteHostLineEdit, 1, 1, 1, 1)
|
||||
self.uiRemotePortLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiRemotePortLabel.setObjectName(_fromUtf8("uiRemotePortLabel"))
|
||||
self.uiRemotePortLabel = QtWidgets.QLabel(self.uiNIOUDPSettingsGroupBox)
|
||||
self.uiRemotePortLabel.setObjectName("uiRemotePortLabel")
|
||||
self.gridlayout3.addWidget(self.uiRemotePortLabel, 2, 0, 1, 1)
|
||||
self.uiRemotePortSpinBox = QtGui.QSpinBox(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiRemotePortSpinBox = QtWidgets.QSpinBox(self.uiNIOUDPSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemotePortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiRemotePortSpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiRemotePortSpinBox.setMaximum(65535)
|
||||
self.uiRemotePortSpinBox.setProperty("value", 20000)
|
||||
self.uiRemotePortSpinBox.setObjectName(_fromUtf8("uiRemotePortSpinBox"))
|
||||
self.uiRemotePortSpinBox.setObjectName("uiRemotePortSpinBox")
|
||||
self.gridlayout3.addWidget(self.uiRemotePortSpinBox, 2, 1, 1, 1)
|
||||
self.gridlayout2.addWidget(self.uiNIOUDPSettingsGroupBox, 0, 0, 1, 2)
|
||||
self.uiNIOUDPListGroupBox = QtGui.QGroupBox(self.tab_2)
|
||||
self.uiNIOUDPListGroupBox.setObjectName(_fromUtf8("uiNIOUDPListGroupBox"))
|
||||
self.vboxlayout2 = QtGui.QVBoxLayout(self.uiNIOUDPListGroupBox)
|
||||
self.vboxlayout2.setObjectName(_fromUtf8("vboxlayout2"))
|
||||
self.uiNIOUDPListWidget = QtGui.QListWidget(self.uiNIOUDPListGroupBox)
|
||||
self.uiNIOUDPListWidget.setObjectName(_fromUtf8("uiNIOUDPListWidget"))
|
||||
self.uiNIOUDPListGroupBox = QtWidgets.QGroupBox(self.NIOUDPTab)
|
||||
self.uiNIOUDPListGroupBox.setObjectName("uiNIOUDPListGroupBox")
|
||||
self.vboxlayout2 = QtWidgets.QVBoxLayout(self.uiNIOUDPListGroupBox)
|
||||
self.vboxlayout2.setObjectName("vboxlayout2")
|
||||
self.uiNIOUDPListWidget = QtWidgets.QListWidget(self.uiNIOUDPListGroupBox)
|
||||
self.uiNIOUDPListWidget.setObjectName("uiNIOUDPListWidget")
|
||||
self.vboxlayout2.addWidget(self.uiNIOUDPListWidget)
|
||||
self.gridlayout2.addWidget(self.uiNIOUDPListGroupBox, 0, 2, 2, 1)
|
||||
self.uiAddNIOUDPPushButton = QtGui.QPushButton(self.tab_2)
|
||||
self.uiAddNIOUDPPushButton.setObjectName(_fromUtf8("uiAddNIOUDPPushButton"))
|
||||
self.uiAddNIOUDPPushButton = QtWidgets.QPushButton(self.NIOUDPTab)
|
||||
self.uiAddNIOUDPPushButton.setObjectName("uiAddNIOUDPPushButton")
|
||||
self.gridlayout2.addWidget(self.uiAddNIOUDPPushButton, 1, 0, 1, 1)
|
||||
self.uiDeleteNIOUDPPushButton = QtGui.QPushButton(self.tab_2)
|
||||
self.uiDeleteNIOUDPPushButton = QtWidgets.QPushButton(self.NIOUDPTab)
|
||||
self.uiDeleteNIOUDPPushButton.setEnabled(False)
|
||||
self.uiDeleteNIOUDPPushButton.setObjectName(_fromUtf8("uiDeleteNIOUDPPushButton"))
|
||||
self.uiDeleteNIOUDPPushButton.setObjectName("uiDeleteNIOUDPPushButton")
|
||||
self.gridlayout2.addWidget(self.uiDeleteNIOUDPPushButton, 1, 1, 1, 1)
|
||||
spacerItem1 = QtGui.QSpacerItem(20, 211, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridlayout2.addItem(spacerItem1, 2, 1, 1, 1)
|
||||
self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
|
||||
self.tab_3 = QtGui.QWidget()
|
||||
self.tab_3.setObjectName(_fromUtf8("tab_3"))
|
||||
self.vboxlayout3 = QtGui.QVBoxLayout(self.tab_3)
|
||||
self.vboxlayout3.setObjectName(_fromUtf8("vboxlayout3"))
|
||||
self.uiNIOTAPGroupBox = QtGui.QGroupBox(self.tab_3)
|
||||
self.uiNIOTAPGroupBox.setObjectName(_fromUtf8("uiNIOTAPGroupBox"))
|
||||
self.gridlayout4 = QtGui.QGridLayout(self.uiNIOTAPGroupBox)
|
||||
self.gridlayout4.setObjectName(_fromUtf8("gridlayout4"))
|
||||
self.uiNIOTAPLineEdit = QtGui.QLineEdit(self.uiNIOTAPGroupBox)
|
||||
self.uiNIOTAPLineEdit.setObjectName(_fromUtf8("uiNIOTAPLineEdit"))
|
||||
spacerItem3 = QtWidgets.QSpacerItem(20, 211, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridlayout2.addItem(spacerItem3, 2, 1, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.NIOUDPTab, "")
|
||||
self.NIOTAPTab = QtWidgets.QWidget()
|
||||
self.NIOTAPTab.setObjectName("NIOTAPTab")
|
||||
self.vboxlayout3 = QtWidgets.QVBoxLayout(self.NIOTAPTab)
|
||||
self.vboxlayout3.setObjectName("vboxlayout3")
|
||||
self.uiNIOTAPGroupBox = QtWidgets.QGroupBox(self.NIOTAPTab)
|
||||
self.uiNIOTAPGroupBox.setObjectName("uiNIOTAPGroupBox")
|
||||
self.gridlayout4 = QtWidgets.QGridLayout(self.uiNIOTAPGroupBox)
|
||||
self.gridlayout4.setObjectName("gridlayout4")
|
||||
self.uiNIOTAPLineEdit = QtWidgets.QLineEdit(self.uiNIOTAPGroupBox)
|
||||
self.uiNIOTAPLineEdit.setObjectName("uiNIOTAPLineEdit")
|
||||
self.gridlayout4.addWidget(self.uiNIOTAPLineEdit, 0, 0, 1, 1)
|
||||
self.uiAddNIOTAPPushButton = QtGui.QPushButton(self.uiNIOTAPGroupBox)
|
||||
self.uiAddNIOTAPPushButton.setObjectName(_fromUtf8("uiAddNIOTAPPushButton"))
|
||||
self.uiAddNIOTAPPushButton = QtWidgets.QPushButton(self.uiNIOTAPGroupBox)
|
||||
self.uiAddNIOTAPPushButton.setObjectName("uiAddNIOTAPPushButton")
|
||||
self.gridlayout4.addWidget(self.uiAddNIOTAPPushButton, 0, 1, 1, 1)
|
||||
self.uiDeleteNIOTAPPushButton = QtGui.QPushButton(self.uiNIOTAPGroupBox)
|
||||
self.uiDeleteNIOTAPPushButton = QtWidgets.QPushButton(self.uiNIOTAPGroupBox)
|
||||
self.uiDeleteNIOTAPPushButton.setEnabled(False)
|
||||
self.uiDeleteNIOTAPPushButton.setObjectName(_fromUtf8("uiDeleteNIOTAPPushButton"))
|
||||
self.uiDeleteNIOTAPPushButton.setObjectName("uiDeleteNIOTAPPushButton")
|
||||
self.gridlayout4.addWidget(self.uiDeleteNIOTAPPushButton, 0, 2, 1, 1)
|
||||
self.uiNIOTAPListWidget = QtGui.QListWidget(self.uiNIOTAPGroupBox)
|
||||
self.uiNIOTAPListWidget.setObjectName(_fromUtf8("uiNIOTAPListWidget"))
|
||||
self.uiNIOTAPListWidget = QtWidgets.QListWidget(self.uiNIOTAPGroupBox)
|
||||
self.uiNIOTAPListWidget.setObjectName("uiNIOTAPListWidget")
|
||||
self.gridlayout4.addWidget(self.uiNIOTAPListWidget, 1, 0, 1, 3)
|
||||
self.vboxlayout3.addWidget(self.uiNIOTAPGroupBox)
|
||||
spacerItem2 = QtGui.QSpacerItem(20, 191, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.vboxlayout3.addItem(spacerItem2)
|
||||
self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
|
||||
self.tab_4 = QtGui.QWidget()
|
||||
self.tab_4.setObjectName(_fromUtf8("tab_4"))
|
||||
self.gridlayout5 = QtGui.QGridLayout(self.tab_4)
|
||||
self.gridlayout5.setObjectName(_fromUtf8("gridlayout5"))
|
||||
self.uiNIOUNIXSettingsGroupBox = QtGui.QGroupBox(self.tab_4)
|
||||
self.uiNIOUNIXSettingsGroupBox.setObjectName(_fromUtf8("uiNIOUNIXSettingsGroupBox"))
|
||||
self.gridlayout6 = QtGui.QGridLayout(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.gridlayout6.setObjectName(_fromUtf8("gridlayout6"))
|
||||
self.gridlayout7 = QtGui.QGridLayout()
|
||||
self.gridlayout7.setObjectName(_fromUtf8("gridlayout7"))
|
||||
self.uiLocalFileLabel = QtGui.QLabel(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.uiLocalFileLabel.setObjectName(_fromUtf8("uiLocalFileLabel"))
|
||||
spacerItem4 = QtWidgets.QSpacerItem(20, 191, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.vboxlayout3.addItem(spacerItem4)
|
||||
self.uiNIOsTabWidget.addTab(self.NIOTAPTab, "")
|
||||
self.NIOUnixTab = QtWidgets.QWidget()
|
||||
self.NIOUnixTab.setObjectName("NIOUnixTab")
|
||||
self.gridlayout5 = QtWidgets.QGridLayout(self.NIOUnixTab)
|
||||
self.gridlayout5.setObjectName("gridlayout5")
|
||||
self.uiNIOUNIXSettingsGroupBox = QtWidgets.QGroupBox(self.NIOUnixTab)
|
||||
self.uiNIOUNIXSettingsGroupBox.setObjectName("uiNIOUNIXSettingsGroupBox")
|
||||
self.gridlayout6 = QtWidgets.QGridLayout(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.gridlayout6.setObjectName("gridlayout6")
|
||||
self.gridlayout7 = QtWidgets.QGridLayout()
|
||||
self.gridlayout7.setObjectName("gridlayout7")
|
||||
self.uiLocalFileLabel = QtWidgets.QLabel(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.uiLocalFileLabel.setObjectName("uiLocalFileLabel")
|
||||
self.gridlayout7.addWidget(self.uiLocalFileLabel, 0, 0, 1, 1)
|
||||
self.uiLocalFileLineEdit = QtGui.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiLocalFileLineEdit = QtWidgets.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiLocalFileLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiLocalFileLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiLocalFileLineEdit.setObjectName(_fromUtf8("uiLocalFileLineEdit"))
|
||||
self.uiLocalFileLineEdit.setObjectName("uiLocalFileLineEdit")
|
||||
self.gridlayout7.addWidget(self.uiLocalFileLineEdit, 1, 0, 1, 1)
|
||||
self.gridlayout6.addLayout(self.gridlayout7, 0, 0, 1, 1)
|
||||
self.gridlayout8 = QtGui.QGridLayout()
|
||||
self.gridlayout8.setObjectName(_fromUtf8("gridlayout8"))
|
||||
self.uiRemoteFileLabel = QtGui.QLabel(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.uiRemoteFileLabel.setObjectName(_fromUtf8("uiRemoteFileLabel"))
|
||||
self.gridlayout8 = QtWidgets.QGridLayout()
|
||||
self.gridlayout8.setObjectName("gridlayout8")
|
||||
self.uiRemoteFileLabel = QtWidgets.QLabel(self.uiNIOUNIXSettingsGroupBox)
|
||||
self.uiRemoteFileLabel.setObjectName("uiRemoteFileLabel")
|
||||
self.gridlayout8.addWidget(self.uiRemoteFileLabel, 0, 0, 1, 1)
|
||||
self.uiRemoteFileLineEdit = QtGui.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiRemoteFileLineEdit = QtWidgets.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteFileLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiRemoteFileLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiRemoteFileLineEdit.setObjectName(_fromUtf8("uiRemoteFileLineEdit"))
|
||||
self.uiRemoteFileLineEdit.setObjectName("uiRemoteFileLineEdit")
|
||||
self.gridlayout8.addWidget(self.uiRemoteFileLineEdit, 1, 0, 1, 1)
|
||||
self.gridlayout6.addLayout(self.gridlayout8, 1, 0, 1, 1)
|
||||
self.gridlayout5.addWidget(self.uiNIOUNIXSettingsGroupBox, 0, 0, 1, 2)
|
||||
self.uiNIOUNIXListGroupBox = QtGui.QGroupBox(self.tab_4)
|
||||
self.uiNIOUNIXListGroupBox.setObjectName(_fromUtf8("uiNIOUNIXListGroupBox"))
|
||||
self.vboxlayout4 = QtGui.QVBoxLayout(self.uiNIOUNIXListGroupBox)
|
||||
self.vboxlayout4.setObjectName(_fromUtf8("vboxlayout4"))
|
||||
self.uiNIOUNIXListWidget = QtGui.QListWidget(self.uiNIOUNIXListGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.uiNIOUNIXListGroupBox = QtWidgets.QGroupBox(self.NIOUnixTab)
|
||||
self.uiNIOUNIXListGroupBox.setObjectName("uiNIOUNIXListGroupBox")
|
||||
self.vboxlayout4 = QtWidgets.QVBoxLayout(self.uiNIOUNIXListGroupBox)
|
||||
self.vboxlayout4.setObjectName("vboxlayout4")
|
||||
self.uiNIOUNIXListWidget = QtWidgets.QListWidget(self.uiNIOUNIXListGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIOUNIXListWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIOUNIXListWidget.setSizePolicy(sizePolicy)
|
||||
self.uiNIOUNIXListWidget.setObjectName(_fromUtf8("uiNIOUNIXListWidget"))
|
||||
self.uiNIOUNIXListWidget.setObjectName("uiNIOUNIXListWidget")
|
||||
self.vboxlayout4.addWidget(self.uiNIOUNIXListWidget)
|
||||
self.gridlayout5.addWidget(self.uiNIOUNIXListGroupBox, 0, 2, 3, 1)
|
||||
self.uiAddNIOUNIXPushButton = QtGui.QPushButton(self.tab_4)
|
||||
self.uiAddNIOUNIXPushButton.setObjectName(_fromUtf8("uiAddNIOUNIXPushButton"))
|
||||
self.uiAddNIOUNIXPushButton = QtWidgets.QPushButton(self.NIOUnixTab)
|
||||
self.uiAddNIOUNIXPushButton.setObjectName("uiAddNIOUNIXPushButton")
|
||||
self.gridlayout5.addWidget(self.uiAddNIOUNIXPushButton, 1, 0, 1, 1)
|
||||
self.uiDeleteNIOUNIXPushButton = QtGui.QPushButton(self.tab_4)
|
||||
self.uiDeleteNIOUNIXPushButton = QtWidgets.QPushButton(self.NIOUnixTab)
|
||||
self.uiDeleteNIOUNIXPushButton.setEnabled(False)
|
||||
self.uiDeleteNIOUNIXPushButton.setObjectName(_fromUtf8("uiDeleteNIOUNIXPushButton"))
|
||||
self.uiDeleteNIOUNIXPushButton.setObjectName("uiDeleteNIOUNIXPushButton")
|
||||
self.gridlayout5.addWidget(self.uiDeleteNIOUNIXPushButton, 1, 1, 1, 1)
|
||||
spacerItem3 = QtGui.QSpacerItem(160, 190, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
self.gridlayout5.addItem(spacerItem3, 2, 0, 2, 2)
|
||||
spacerItem4 = QtGui.QSpacerItem(196, 132, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridlayout5.addItem(spacerItem4, 3, 2, 1, 1)
|
||||
self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
|
||||
self.tab_5 = QtGui.QWidget()
|
||||
self.tab_5.setObjectName(_fromUtf8("tab_5"))
|
||||
self.gridlayout9 = QtGui.QGridLayout(self.tab_5)
|
||||
self.gridlayout9.setObjectName(_fromUtf8("gridlayout9"))
|
||||
self.uiNIOVDESettingsGroupBox = QtGui.QGroupBox(self.tab_5)
|
||||
self.uiNIOVDESettingsGroupBox.setObjectName(_fromUtf8("uiNIOVDESettingsGroupBox"))
|
||||
self.gridlayout10 = QtGui.QGridLayout(self.uiNIOVDESettingsGroupBox)
|
||||
self.gridlayout10.setObjectName(_fromUtf8("gridlayout10"))
|
||||
self.gridlayout11 = QtGui.QGridLayout()
|
||||
self.gridlayout11.setObjectName(_fromUtf8("gridlayout11"))
|
||||
self.uiVDEControlFileLabel = QtGui.QLabel(self.uiNIOVDESettingsGroupBox)
|
||||
self.uiVDEControlFileLabel.setObjectName(_fromUtf8("uiVDEControlFileLabel"))
|
||||
spacerItem5 = QtWidgets.QSpacerItem(160, 190, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.gridlayout5.addItem(spacerItem5, 2, 0, 2, 2)
|
||||
spacerItem6 = QtWidgets.QSpacerItem(196, 132, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridlayout5.addItem(spacerItem6, 3, 2, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.NIOUnixTab, "")
|
||||
self.NIOVDETab = QtWidgets.QWidget()
|
||||
self.NIOVDETab.setObjectName("NIOVDETab")
|
||||
self.gridlayout9 = QtWidgets.QGridLayout(self.NIOVDETab)
|
||||
self.gridlayout9.setObjectName("gridlayout9")
|
||||
self.uiNIOVDESettingsGroupBox = QtWidgets.QGroupBox(self.NIOVDETab)
|
||||
self.uiNIOVDESettingsGroupBox.setObjectName("uiNIOVDESettingsGroupBox")
|
||||
self.gridlayout10 = QtWidgets.QGridLayout(self.uiNIOVDESettingsGroupBox)
|
||||
self.gridlayout10.setObjectName("gridlayout10")
|
||||
self.gridlayout11 = QtWidgets.QGridLayout()
|
||||
self.gridlayout11.setObjectName("gridlayout11")
|
||||
self.uiVDEControlFileLabel = QtWidgets.QLabel(self.uiNIOVDESettingsGroupBox)
|
||||
self.uiVDEControlFileLabel.setObjectName("uiVDEControlFileLabel")
|
||||
self.gridlayout11.addWidget(self.uiVDEControlFileLabel, 0, 0, 1, 1)
|
||||
self.uiVDEControlFileLineEdit = QtGui.QLineEdit(self.uiNIOVDESettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiVDEControlFileLineEdit = QtWidgets.QLineEdit(self.uiNIOVDESettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiVDEControlFileLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiVDEControlFileLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiVDEControlFileLineEdit.setObjectName(_fromUtf8("uiVDEControlFileLineEdit"))
|
||||
self.uiVDEControlFileLineEdit.setObjectName("uiVDEControlFileLineEdit")
|
||||
self.gridlayout11.addWidget(self.uiVDEControlFileLineEdit, 1, 0, 1, 1)
|
||||
self.gridlayout10.addLayout(self.gridlayout11, 0, 0, 1, 1)
|
||||
self.gridlayout12 = QtGui.QGridLayout()
|
||||
self.gridlayout12.setObjectName(_fromUtf8("gridlayout12"))
|
||||
self.uiVDELocalFileLabel = QtGui.QLabel(self.uiNIOVDESettingsGroupBox)
|
||||
self.uiVDELocalFileLabel.setObjectName(_fromUtf8("uiVDELocalFileLabel"))
|
||||
self.gridlayout12 = QtWidgets.QGridLayout()
|
||||
self.gridlayout12.setObjectName("gridlayout12")
|
||||
self.uiVDELocalFileLabel = QtWidgets.QLabel(self.uiNIOVDESettingsGroupBox)
|
||||
self.uiVDELocalFileLabel.setObjectName("uiVDELocalFileLabel")
|
||||
self.gridlayout12.addWidget(self.uiVDELocalFileLabel, 0, 0, 1, 1)
|
||||
self.uiVDELocalFileLineEdit = QtGui.QLineEdit(self.uiNIOVDESettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiVDELocalFileLineEdit = QtWidgets.QLineEdit(self.uiNIOVDESettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiVDELocalFileLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiVDELocalFileLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiVDELocalFileLineEdit.setObjectName(_fromUtf8("uiVDELocalFileLineEdit"))
|
||||
self.uiVDELocalFileLineEdit.setObjectName("uiVDELocalFileLineEdit")
|
||||
self.gridlayout12.addWidget(self.uiVDELocalFileLineEdit, 1, 0, 1, 1)
|
||||
self.gridlayout10.addLayout(self.gridlayout12, 1, 0, 1, 1)
|
||||
self.gridlayout9.addWidget(self.uiNIOVDESettingsGroupBox, 0, 0, 1, 2)
|
||||
self.uiNIOVDEListGroupBox = QtGui.QGroupBox(self.tab_5)
|
||||
self.uiNIOVDEListGroupBox.setObjectName(_fromUtf8("uiNIOVDEListGroupBox"))
|
||||
self.vboxlayout5 = QtGui.QVBoxLayout(self.uiNIOVDEListGroupBox)
|
||||
self.vboxlayout5.setObjectName(_fromUtf8("vboxlayout5"))
|
||||
self.uiNIOVDEListWidget = QtGui.QListWidget(self.uiNIOVDEListGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.uiNIOVDEListGroupBox = QtWidgets.QGroupBox(self.NIOVDETab)
|
||||
self.uiNIOVDEListGroupBox.setObjectName("uiNIOVDEListGroupBox")
|
||||
self.vboxlayout5 = QtWidgets.QVBoxLayout(self.uiNIOVDEListGroupBox)
|
||||
self.vboxlayout5.setObjectName("vboxlayout5")
|
||||
self.uiNIOVDEListWidget = QtWidgets.QListWidget(self.uiNIOVDEListGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIOVDEListWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIOVDEListWidget.setSizePolicy(sizePolicy)
|
||||
self.uiNIOVDEListWidget.setObjectName(_fromUtf8("uiNIOVDEListWidget"))
|
||||
self.uiNIOVDEListWidget.setObjectName("uiNIOVDEListWidget")
|
||||
self.vboxlayout5.addWidget(self.uiNIOVDEListWidget)
|
||||
self.gridlayout9.addWidget(self.uiNIOVDEListGroupBox, 0, 2, 3, 1)
|
||||
self.uiAddNIOVDEPushButton = QtGui.QPushButton(self.tab_5)
|
||||
self.uiAddNIOVDEPushButton.setObjectName(_fromUtf8("uiAddNIOVDEPushButton"))
|
||||
self.uiAddNIOVDEPushButton = QtWidgets.QPushButton(self.NIOVDETab)
|
||||
self.uiAddNIOVDEPushButton.setObjectName("uiAddNIOVDEPushButton")
|
||||
self.gridlayout9.addWidget(self.uiAddNIOVDEPushButton, 1, 0, 1, 1)
|
||||
self.uiDeleteNIOVDEPushButton = QtGui.QPushButton(self.tab_5)
|
||||
self.uiDeleteNIOVDEPushButton = QtWidgets.QPushButton(self.NIOVDETab)
|
||||
self.uiDeleteNIOVDEPushButton.setEnabled(False)
|
||||
self.uiDeleteNIOVDEPushButton.setObjectName(_fromUtf8("uiDeleteNIOVDEPushButton"))
|
||||
self.uiDeleteNIOVDEPushButton.setObjectName("uiDeleteNIOVDEPushButton")
|
||||
self.gridlayout9.addWidget(self.uiDeleteNIOVDEPushButton, 1, 1, 1, 1)
|
||||
spacerItem5 = QtGui.QSpacerItem(161, 201, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
||||
self.gridlayout9.addItem(spacerItem5, 2, 0, 2, 2)
|
||||
spacerItem6 = QtGui.QSpacerItem(196, 132, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridlayout9.addItem(spacerItem6, 3, 2, 1, 1)
|
||||
self.tabWidget.addTab(self.tab_5, _fromUtf8(""))
|
||||
self.tab_6 = QtGui.QWidget()
|
||||
self.tab_6.setObjectName(_fromUtf8("tab_6"))
|
||||
self.gridlayout13 = QtGui.QGridLayout(self.tab_6)
|
||||
self.gridlayout13.setObjectName(_fromUtf8("gridlayout13"))
|
||||
self.uiNIONullSettingsGroupBox = QtGui.QGroupBox(self.tab_6)
|
||||
self.uiNIONullSettingsGroupBox.setObjectName(_fromUtf8("uiNIONullSettingsGroupBox"))
|
||||
self.gridlayout14 = QtGui.QGridLayout(self.uiNIONullSettingsGroupBox)
|
||||
self.gridlayout14.setObjectName(_fromUtf8("gridlayout14"))
|
||||
self.label_9 = QtGui.QLabel(self.uiNIONullSettingsGroupBox)
|
||||
self.label_9.setObjectName(_fromUtf8("label_9"))
|
||||
self.gridlayout14.addWidget(self.label_9, 0, 0, 1, 1)
|
||||
self.uiNIONullIdentiferLineEdit = QtGui.QLineEdit(self.uiNIONullSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
spacerItem7 = QtWidgets.QSpacerItem(161, 201, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.gridlayout9.addItem(spacerItem7, 2, 0, 2, 2)
|
||||
spacerItem8 = QtWidgets.QSpacerItem(196, 132, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridlayout9.addItem(spacerItem8, 3, 2, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.NIOVDETab, "")
|
||||
self.NIONullTab = QtWidgets.QWidget()
|
||||
self.NIONullTab.setObjectName("NIONullTab")
|
||||
self.gridlayout13 = QtWidgets.QGridLayout(self.NIONullTab)
|
||||
self.gridlayout13.setObjectName("gridlayout13")
|
||||
self.uiNIONullSettingsGroupBox = QtWidgets.QGroupBox(self.NIONullTab)
|
||||
self.uiNIONullSettingsGroupBox.setObjectName("uiNIONullSettingsGroupBox")
|
||||
self.gridlayout14 = QtWidgets.QGridLayout(self.uiNIONullSettingsGroupBox)
|
||||
self.gridlayout14.setObjectName("gridlayout14")
|
||||
self.uiNIONullIdentifierLabel = QtWidgets.QLabel(self.uiNIONullSettingsGroupBox)
|
||||
self.uiNIONullIdentifierLabel.setObjectName("uiNIONullIdentifierLabel")
|
||||
self.gridlayout14.addWidget(self.uiNIONullIdentifierLabel, 0, 0, 1, 1)
|
||||
self.uiNIONullIdentiferLineEdit = QtWidgets.QLineEdit(self.uiNIONullSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIONullIdentiferLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIONullIdentiferLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiNIONullIdentiferLineEdit.setObjectName(_fromUtf8("uiNIONullIdentiferLineEdit"))
|
||||
self.uiNIONullIdentiferLineEdit.setObjectName("uiNIONullIdentiferLineEdit")
|
||||
self.gridlayout14.addWidget(self.uiNIONullIdentiferLineEdit, 1, 0, 1, 1)
|
||||
self.gridlayout13.addWidget(self.uiNIONullSettingsGroupBox, 0, 0, 1, 2)
|
||||
self.uiNIONullListGroupBox = QtGui.QGroupBox(self.tab_6)
|
||||
self.uiNIONullListGroupBox.setObjectName(_fromUtf8("uiNIONullListGroupBox"))
|
||||
self.vboxlayout6 = QtGui.QVBoxLayout(self.uiNIONullListGroupBox)
|
||||
self.vboxlayout6.setObjectName(_fromUtf8("vboxlayout6"))
|
||||
self.uiNIONullListWidget = QtGui.QListWidget(self.uiNIONullListGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.uiNIONullListGroupBox = QtWidgets.QGroupBox(self.NIONullTab)
|
||||
self.uiNIONullListGroupBox.setObjectName("uiNIONullListGroupBox")
|
||||
self.vboxlayout6 = QtWidgets.QVBoxLayout(self.uiNIONullListGroupBox)
|
||||
self.vboxlayout6.setObjectName("vboxlayout6")
|
||||
self.uiNIONullListWidget = QtWidgets.QListWidget(self.uiNIONullListGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiNIONullListWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiNIONullListWidget.setSizePolicy(sizePolicy)
|
||||
self.uiNIONullListWidget.setObjectName(_fromUtf8("uiNIONullListWidget"))
|
||||
self.uiNIONullListWidget.setObjectName("uiNIONullListWidget")
|
||||
self.vboxlayout6.addWidget(self.uiNIONullListWidget)
|
||||
self.gridlayout13.addWidget(self.uiNIONullListGroupBox, 0, 2, 3, 1)
|
||||
self.uiAddNIONullPushButton = QtGui.QPushButton(self.tab_6)
|
||||
self.uiAddNIONullPushButton.setObjectName(_fromUtf8("uiAddNIONullPushButton"))
|
||||
self.uiAddNIONullPushButton = QtWidgets.QPushButton(self.NIONullTab)
|
||||
self.uiAddNIONullPushButton.setObjectName("uiAddNIONullPushButton")
|
||||
self.gridlayout13.addWidget(self.uiAddNIONullPushButton, 1, 0, 1, 1)
|
||||
self.uiDeleteNIONullPushButton = QtGui.QPushButton(self.tab_6)
|
||||
self.uiDeleteNIONullPushButton = QtWidgets.QPushButton(self.NIONullTab)
|
||||
self.uiDeleteNIONullPushButton.setEnabled(False)
|
||||
self.uiDeleteNIONullPushButton.setObjectName(_fromUtf8("uiDeleteNIONullPushButton"))
|
||||
self.uiDeleteNIONullPushButton.setObjectName("uiDeleteNIONullPushButton")
|
||||
self.gridlayout13.addWidget(self.uiDeleteNIONullPushButton, 1, 1, 1, 1)
|
||||
spacerItem7 = QtGui.QSpacerItem(20, 261, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridlayout13.addItem(spacerItem7, 2, 0, 2, 2)
|
||||
spacerItem8 = QtGui.QSpacerItem(20, 181, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridlayout13.addItem(spacerItem8, 3, 2, 1, 1)
|
||||
self.tabWidget.addTab(self.tab_6, _fromUtf8(""))
|
||||
self.tab_7 = QtGui.QWidget()
|
||||
self.tab_7.setObjectName(_fromUtf8("tab_7"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.tab_7)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.uiNameLabel = QtGui.QLabel(self.tab_7)
|
||||
self.uiNameLabel.setObjectName(_fromUtf8("uiNameLabel"))
|
||||
spacerItem9 = QtWidgets.QSpacerItem(20, 261, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridlayout13.addItem(spacerItem9, 2, 0, 2, 2)
|
||||
spacerItem10 = QtWidgets.QSpacerItem(20, 181, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridlayout13.addItem(spacerItem10, 3, 2, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.NIONullTab, "")
|
||||
self.MiscTab = QtWidgets.QWidget()
|
||||
self.MiscTab.setObjectName("MiscTab")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.MiscTab)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtGui.QLineEdit(self.tab_7)
|
||||
self.uiNameLineEdit.setObjectName(_fromUtf8("uiNameLineEdit"))
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
spacerItem9 = QtGui.QSpacerItem(20, 399, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem9, 1, 1, 1, 1)
|
||||
self.tabWidget.addTab(self.tab_7, _fromUtf8(""))
|
||||
self.vboxlayout.addWidget(self.tabWidget)
|
||||
spacerItem11 = QtWidgets.QSpacerItem(20, 399, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem11, 1, 1, 1, 1)
|
||||
self.uiNIOsTabWidget.addTab(self.MiscTab, "")
|
||||
self.vboxlayout.addWidget(self.uiNIOsTabWidget)
|
||||
|
||||
self.retranslateUi(cloudConfigPageWidget)
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
self.uiNIOsTabWidget.setCurrentIndex(0)
|
||||
QtCore.QMetaObject.connectSlotsByName(cloudConfigPageWidget)
|
||||
|
||||
def retranslateUi(self, cloudConfigPageWidget):
|
||||
cloudConfigPageWidget.setWindowTitle(_translate("cloudConfigPageWidget", "Cloud configuration", None))
|
||||
self.uiGenericEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Generic Ethernet NIO (Administrator or root access required)", None))
|
||||
self.uiAddGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.uiLinuxEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Linux Ethernet NIO (Linux only, root access required)", None))
|
||||
self.uiAddLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("cloudConfigPageWidget", "NIO Ethernet", None))
|
||||
self.uiNIOUDPSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
|
||||
self.uiLocalPortLabel.setText(_translate("cloudConfigPageWidget", "Local port:", None))
|
||||
self.uiRemoteHostLabel.setText(_translate("cloudConfigPageWidget", "Remote host:", None))
|
||||
self.uiRemoteHostLineEdit.setText(_translate("cloudConfigPageWidget", "127.0.0.1", None))
|
||||
self.uiRemotePortLabel.setText(_translate("cloudConfigPageWidget", "Remote port:", None))
|
||||
self.uiNIOUDPListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
|
||||
self.uiAddNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("cloudConfigPageWidget", "NIO UDP", None))
|
||||
self.uiNIOTAPGroupBox.setTitle(_translate("cloudConfigPageWidget", "TAP interface (require root access)", None))
|
||||
self.uiAddNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("cloudConfigPageWidget", "NIO TAP", None))
|
||||
self.uiNIOUNIXSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
|
||||
self.uiLocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:", None))
|
||||
self.uiRemoteFileLabel.setText(_translate("cloudConfigPageWidget", "Remote file:", None))
|
||||
self.uiNIOUNIXListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
|
||||
self.uiAddNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("cloudConfigPageWidget", "NIO UNIX", None))
|
||||
self.uiNIOVDESettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
|
||||
self.uiVDEControlFileLabel.setText(_translate("cloudConfigPageWidget", "Control file:", None))
|
||||
self.uiVDELocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:", None))
|
||||
self.uiNIOVDEListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
|
||||
self.uiAddNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("cloudConfigPageWidget", "NIO VDE", None))
|
||||
self.uiNIONullSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
|
||||
self.label_9.setText(_translate("cloudConfigPageWidget", "Identifier:", None))
|
||||
self.uiNIONullListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
|
||||
self.uiAddNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
|
||||
self.uiDeleteNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("cloudConfigPageWidget", "NIO NULL", None))
|
||||
self.uiNameLabel.setText(_translate("cloudConfigPageWidget", "Name:", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), _translate("cloudConfigPageWidget", "Misc.", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
cloudConfigPageWidget.setWindowTitle(_translate("cloudConfigPageWidget", "Cloud configuration"))
|
||||
self.uiGenericEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Generic Ethernet NIO (Administrator or root access required)"))
|
||||
self.uiAddGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiLinuxEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Linux Ethernet NIO (Linux only, root access required)"))
|
||||
self.uiAddLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIOEthernetTab), _translate("cloudConfigPageWidget", "Ethernet"))
|
||||
self.uiNIONATSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings"))
|
||||
self.uiNIONATIdentifierLabel.setText(_translate("cloudConfigPageWidget", "Local identifier:"))
|
||||
self.uiNIONATListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs"))
|
||||
self.uiAddNIONATPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIONATPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIONATTab), _translate("cloudConfigPageWidget", "NAT"))
|
||||
self.uiNIOUDPSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings"))
|
||||
self.uiLocalPortLabel.setText(_translate("cloudConfigPageWidget", "Local port:"))
|
||||
self.uiRemoteHostLabel.setText(_translate("cloudConfigPageWidget", "Remote host:"))
|
||||
self.uiRemoteHostLineEdit.setText(_translate("cloudConfigPageWidget", "127.0.0.1"))
|
||||
self.uiRemotePortLabel.setText(_translate("cloudConfigPageWidget", "Remote port:"))
|
||||
self.uiNIOUDPListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs"))
|
||||
self.uiAddNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIOUDPTab), _translate("cloudConfigPageWidget", "UDP"))
|
||||
self.uiNIOTAPGroupBox.setTitle(_translate("cloudConfigPageWidget", "TAP interface (require root access)"))
|
||||
self.uiAddNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIOTAPTab), _translate("cloudConfigPageWidget", "TAP"))
|
||||
self.uiNIOUNIXSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings"))
|
||||
self.uiLocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:"))
|
||||
self.uiRemoteFileLabel.setText(_translate("cloudConfigPageWidget", "Remote file:"))
|
||||
self.uiNIOUNIXListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs"))
|
||||
self.uiAddNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIOUnixTab), _translate("cloudConfigPageWidget", "UNIX"))
|
||||
self.uiNIOVDESettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings"))
|
||||
self.uiVDEControlFileLabel.setText(_translate("cloudConfigPageWidget", "Control file:"))
|
||||
self.uiVDELocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:"))
|
||||
self.uiNIOVDEListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs"))
|
||||
self.uiAddNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIOVDETab), _translate("cloudConfigPageWidget", "VDE"))
|
||||
self.uiNIONullSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings"))
|
||||
self.uiNIONullIdentifierLabel.setText(_translate("cloudConfigPageWidget", "Local identifier:"))
|
||||
self.uiNIONullListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs"))
|
||||
self.uiAddNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Add"))
|
||||
self.uiDeleteNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Delete"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.NIONullTab), _translate("cloudConfigPageWidget", "NULL"))
|
||||
self.uiNameLabel.setText(_translate("cloudConfigPageWidget", "Name:"))
|
||||
self.uiNIOsTabWidget.setTabText(self.uiNIOsTabWidget.indexOf(self.MiscTab), _translate("cloudConfigPageWidget", "Misc."))
|
||||
|
||||
|
||||
@@ -20,11 +20,15 @@ Dynamips module implementation.
|
||||
"""
|
||||
|
||||
import os
|
||||
import glob
|
||||
import shutil
|
||||
import hashlib
|
||||
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.servers import Servers
|
||||
from gns3.node import Node
|
||||
from gns3.local_config import LocalConfig
|
||||
from gns3.image_manager import ImageManager
|
||||
from gns3.local_server_config import LocalServerConfig
|
||||
from gns3.gns3_vm import GNS3VM
|
||||
|
||||
from ..module import Module
|
||||
from ..module_error import ModuleError
|
||||
@@ -41,9 +45,10 @@ from .nodes.ethernet_switch import EthernetSwitch
|
||||
from .nodes.ethernet_hub import EthernetHub
|
||||
from .nodes.frame_relay_switch import FrameRelaySwitch
|
||||
from .nodes.atm_switch import ATMSwitch
|
||||
from .settings import DYNAMIPS_SETTINGS, DYNAMIPS_SETTING_TYPES
|
||||
from .settings import IOS_ROUTER_SETTINGS, IOS_ROUTER_SETTING_TYPES
|
||||
from .settings import DYNAMIPS_SETTINGS
|
||||
from .settings import IOS_ROUTER_SETTINGS
|
||||
from .settings import PLATFORMS_DEFAULT_RAM
|
||||
from .settings import DEFAULT_IDLEPC
|
||||
|
||||
PLATFORM_TO_CLASS = {
|
||||
"c1700": C1700,
|
||||
@@ -55,42 +60,74 @@ PLATFORM_TO_CLASS = {
|
||||
"c7200": C7200
|
||||
}
|
||||
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Dynamips(Module):
|
||||
|
||||
"""
|
||||
Dynamips module.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
Module.__init__(self)
|
||||
super().__init__()
|
||||
|
||||
self._settings = {}
|
||||
self._ios_routers = {}
|
||||
self._servers = []
|
||||
self._nodes = []
|
||||
self._working_dir = ""
|
||||
self._images_dir = ""
|
||||
self._ios_images_cache = {}
|
||||
|
||||
self.configChangedSlot()
|
||||
|
||||
def configChangedSlot(self):
|
||||
# load the settings and IOS images.
|
||||
self._loadSettings()
|
||||
self._loadIOSRouters()
|
||||
|
||||
@staticmethod
|
||||
def getDefaultIdlePC(path):
|
||||
"""
|
||||
Return the default IDLE PC for an image if the image
|
||||
exists or None otherwise
|
||||
"""
|
||||
if not os.path.isfile(path):
|
||||
path = os.path.join(ImageManager.instance().getDirectoryForType("DYNAMIPS"), path)
|
||||
if not os.path.isfile(path):
|
||||
return None
|
||||
try:
|
||||
md5sum = Dynamips._md5sum(path)
|
||||
log.debug("Get idlePC for %s. md5sum %s", path, md5sum)
|
||||
if md5sum in DEFAULT_IDLEPC:
|
||||
log.debug("IDLEPC found for %s", path)
|
||||
return DEFAULT_IDLEPC[md5sum]
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _md5sum(path):
|
||||
with open(path, "rb") as fd:
|
||||
m = hashlib.md5()
|
||||
while True:
|
||||
data = fd.read(8192)
|
||||
if not data:
|
||||
break
|
||||
m.update(data)
|
||||
return m.hexdigest()
|
||||
|
||||
def _loadSettings(self):
|
||||
"""
|
||||
Loads the settings from the persistent settings file.
|
||||
"""
|
||||
|
||||
# load the settings
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.__class__.__name__)
|
||||
for name, value in DYNAMIPS_SETTINGS.items():
|
||||
self._settings[name] = settings.value(name, value, type=DYNAMIPS_SETTING_TYPES[name])
|
||||
settings.endGroup()
|
||||
self._settings = LocalConfig.instance().loadSectionSettings(self.__class__.__name__, DYNAMIPS_SETTINGS)
|
||||
if not os.path.exists(self._settings["dynamips_path"]):
|
||||
dynamips_path = shutil.which("dynamips")
|
||||
if dynamips_path:
|
||||
self._settings["dynamips_path"] = os.path.abspath(dynamips_path)
|
||||
else:
|
||||
self._settings["dynamips_path"] = ""
|
||||
|
||||
self._loadIOSRouters()
|
||||
|
||||
def _saveSettings(self):
|
||||
"""
|
||||
@@ -98,176 +135,50 @@ class Dynamips(Module):
|
||||
"""
|
||||
|
||||
# save the settings
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup(self.__class__.__name__)
|
||||
for name, value in self._settings.items():
|
||||
settings.setValue(name, value)
|
||||
settings.endGroup()
|
||||
LocalConfig.instance().saveSectionSettings(self.__class__.__name__, self._settings)
|
||||
|
||||
# save some settings to the local server config file
|
||||
server_settings = {
|
||||
"allocate_aux_console_ports": self._settings["allocate_aux_console_ports"],
|
||||
"ghost_ios_support": self._settings["ghost_ios_support"],
|
||||
"sparse_memory_support": self._settings["sparse_memory_support"],
|
||||
"mmap_support": self._settings["mmap_support"],
|
||||
}
|
||||
|
||||
if self._settings["dynamips_path"]:
|
||||
server_settings["dynamips_path"] = os.path.normpath(self._settings["dynamips_path"])
|
||||
config = LocalServerConfig.instance()
|
||||
config.saveSettings(self.__class__.__name__, server_settings)
|
||||
|
||||
def _loadIOSRouters(self):
|
||||
"""
|
||||
Load the IOS routers from the persistent settings file.
|
||||
"""
|
||||
|
||||
# load the settings
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup("IOSRouters")
|
||||
|
||||
# load the IOS images
|
||||
size = settings.beginReadArray("ios_router")
|
||||
for index in range(0, size):
|
||||
settings.setArrayIndex(index)
|
||||
name = settings.value("name")
|
||||
server = settings.value("server")
|
||||
key = "{server}:{name}".format(server=server, name=name)
|
||||
if key in self._ios_routers or not name or not server:
|
||||
continue
|
||||
self._ios_routers[key] = {}
|
||||
for setting_name, default_value in IOS_ROUTER_SETTINGS.items():
|
||||
self._ios_routers[key][setting_name] = settings.value(setting_name, default_value, IOS_ROUTER_SETTING_TYPES[setting_name])
|
||||
|
||||
for slot_id in range(0, 7):
|
||||
slot = "slot{}".format(slot_id)
|
||||
if settings.contains(slot):
|
||||
self._ios_routers[key][slot] = settings.value(slot, "")
|
||||
|
||||
for wic_id in range(0, 3):
|
||||
wic = "wic{}".format(wic_id)
|
||||
if settings.contains(wic):
|
||||
self._ios_routers[key][wic] = settings.value(wic, "")
|
||||
|
||||
platform = self._ios_routers[key]["platform"]
|
||||
chassis = self._ios_routers[key]["chassis"]
|
||||
|
||||
if platform == "c7200":
|
||||
self._ios_routers[key]["midplane"] = settings.value("midplane", "vxr")
|
||||
self._ios_routers[key]["npe"] = settings.value("npe", "npe-400")
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C7200-IO-FE")
|
||||
else:
|
||||
self._ios_routers[key]["iomem"] = 5
|
||||
|
||||
if platform in ("c3725", "c3725", "c2691"):
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "GT96100-FE")
|
||||
elif platform == "c3600" and chassis == "3660":
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "Leopard-2FE")
|
||||
elif platform == "c2600" and chassis == "2610":
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C2600-MB-1E")
|
||||
elif platform == "c2600" and chassis == "2611":
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C2600-MB-2E")
|
||||
elif platform == "c2600" and chassis in ("2620", "2610XM", "2620XM", "2650XM"):
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C2600-MB-1FE")
|
||||
elif platform == "c2600" and chassis in ("2621", "2611XM", "2621XM", "2651XM"):
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C2600-MB-2FE")
|
||||
elif platform == "c1700" and chassis in ("1720", "1721", "1750", "1751", "1760"):
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C1700-MB-1FE")
|
||||
elif platform == "c1700" and chassis in ("1751", "1760"):
|
||||
self._ios_routers[key]["slot0"] = settings.value("slot0", "C1700-MB-WIC1")
|
||||
|
||||
settings.endArray()
|
||||
settings.endGroup()
|
||||
settings = LocalConfig.instance().settings()
|
||||
if "routers" in settings.get(self.__class__.__name__, {}):
|
||||
for router in settings[self.__class__.__name__]["routers"]:
|
||||
name = router.get("name")
|
||||
server = router.get("server")
|
||||
router["image"] = router.get("path", router["image"]) # for backward compatibility before version 1.3
|
||||
key = "{server}:{name}".format(server=server, name=name)
|
||||
if key in self._ios_routers or not name or not server:
|
||||
continue
|
||||
router_settings = IOS_ROUTER_SETTINGS.copy()
|
||||
router_settings.update(router)
|
||||
# for backward compatibility before version 1.4
|
||||
if "symbol" not in router_settings:
|
||||
router_settings["symbol"] = router_settings["default_symbol"]
|
||||
router_settings["symbol"] = router_settings["symbol"][:-11] + ".svg" if router_settings["symbol"].endswith("normal.svg") else router_settings["symbol"]
|
||||
self._ios_routers[key] = router_settings
|
||||
|
||||
def _saveIOSRouters(self):
|
||||
"""
|
||||
Saves the IOS routers to the persistent settings file.
|
||||
"""
|
||||
|
||||
# save the settings
|
||||
settings = QtCore.QSettings()
|
||||
settings.beginGroup("IOSRouters")
|
||||
settings.remove("")
|
||||
|
||||
# save the IOS images
|
||||
settings.beginWriteArray("ios_router", len(self._ios_routers))
|
||||
index = 0
|
||||
for ios_router in self._ios_routers.values():
|
||||
settings.setArrayIndex(index)
|
||||
for name, value in ios_router.items():
|
||||
settings.setValue(name, value)
|
||||
index += 1
|
||||
settings.endArray()
|
||||
settings.endGroup()
|
||||
|
||||
def _delete_dynamips_files(self):
|
||||
"""
|
||||
Deletes useless local Dynamips files from the working directory
|
||||
"""
|
||||
|
||||
files = glob.glob(os.path.join(self._working_dir, "dynamips", "*.ghost"))
|
||||
files += glob.glob(os.path.join(self._working_dir, "dynamips", "*_lock"))
|
||||
files += glob.glob(os.path.join(self._working_dir, "dynamips", "ilt_*"))
|
||||
files += glob.glob(os.path.join(self._working_dir, "dynamips", "c[0-9][0-9][0-9][0-9]_*_rommon_vars"))
|
||||
files += glob.glob(os.path.join(self._working_dir, "dynamips", "c[0-9][0-9][0-9][0-9]_*_ssa"))
|
||||
for file in files:
|
||||
try:
|
||||
log.debug("deleting file {}".format(file))
|
||||
os.remove(file)
|
||||
except OSError as e:
|
||||
log.warn("could not delete file {}: {}".format(file, e))
|
||||
continue
|
||||
|
||||
def setProjectFilesDir(self, path):
|
||||
"""
|
||||
Sets the project files directory path this module.
|
||||
|
||||
:param path: path to the local project files directory
|
||||
"""
|
||||
|
||||
#self._delete_dynamips_files() #FIXME: cause issues
|
||||
self._working_dir = path
|
||||
log.info("local working directory for Dynamips module: {}".format(self._working_dir))
|
||||
|
||||
# update the server with the new working directory / project name
|
||||
for server in self._servers:
|
||||
if server.connected():
|
||||
self._sendSettings(server)
|
||||
|
||||
def setImageFilesDir(self, path):
|
||||
"""
|
||||
Sets the image files directory path this module.
|
||||
|
||||
:param path: path to the local image files directory
|
||||
"""
|
||||
|
||||
self._images_dir = os.path.join(path, "IOS")
|
||||
|
||||
def imageFilesDir(self):
|
||||
"""
|
||||
Returns the files directory path this module.
|
||||
|
||||
:returns: path to the local image files directory
|
||||
"""
|
||||
|
||||
return self._images_dir
|
||||
|
||||
def addServer(self, server):
|
||||
"""
|
||||
Adds a server to be used by this module.
|
||||
|
||||
:param server: WebSocketClient instance
|
||||
"""
|
||||
|
||||
log.info("adding server {}:{} to Dynamips module".format(server.host, server.port))
|
||||
self._servers.append(server)
|
||||
self._sendSettings(server)
|
||||
|
||||
def removeServer(self, server):
|
||||
"""
|
||||
Removes a server from being used by this module.
|
||||
|
||||
:param server: WebSocketClient instance
|
||||
"""
|
||||
|
||||
log.info("removing server {}:{} from Dynamips module".format(server.host, server.port))
|
||||
self._servers.remove(server)
|
||||
|
||||
def servers(self):
|
||||
"""
|
||||
Returns all the servers used by this module.
|
||||
|
||||
:returns: list of WebSocketClient instances
|
||||
"""
|
||||
|
||||
return self._servers
|
||||
self._settings["routers"] = list(self._ios_routers.values())
|
||||
self._saveSettings()
|
||||
|
||||
def addNode(self, node):
|
||||
"""
|
||||
@@ -286,6 +197,8 @@ class Dynamips(Module):
|
||||
"""
|
||||
|
||||
if node in self._nodes:
|
||||
if "ram" in node.settings():
|
||||
node.server().decreaseAllocatedRAM(node.settings()["ram"])
|
||||
self._nodes.remove(node)
|
||||
|
||||
def iosRouters(self):
|
||||
@@ -323,99 +236,22 @@ class Dynamips(Module):
|
||||
:param settings: module settings (dictionary)
|
||||
"""
|
||||
|
||||
params = {}
|
||||
for name, value in settings.items():
|
||||
if name in self._settings and self._settings[name] != value:
|
||||
params[name] = value
|
||||
|
||||
if params:
|
||||
for server in self._servers:
|
||||
if server.isLocal():
|
||||
params.update({"working_dir": self._working_dir})
|
||||
else:
|
||||
if "path" in params:
|
||||
del params["path"] # do not send Dynamips path to remote servers
|
||||
project_name = os.path.basename(self._working_dir)
|
||||
if project_name.endswith("-files"):
|
||||
project_name = project_name[:-6]
|
||||
params.update({"project_name": project_name})
|
||||
server.send_notification("dynamips.settings", params)
|
||||
|
||||
self._settings.update(settings)
|
||||
self._saveSettings()
|
||||
|
||||
def _sendSettings(self, server):
|
||||
"""
|
||||
Sends the module settings to the server.
|
||||
|
||||
:param server: WebSocketClient instance
|
||||
"""
|
||||
|
||||
log.info("sending Dynamips settings to server {}:{}".format(server.host, server.port))
|
||||
params = self._settings.copy()
|
||||
# send the local working directory only if this is a local server
|
||||
if server.isLocal():
|
||||
params.update({"working_dir": self._working_dir})
|
||||
else:
|
||||
if "path" in params:
|
||||
del params["path"] # do not send Dynamips path to remote servers
|
||||
project_name = os.path.basename(self._working_dir)
|
||||
if project_name.endswith("-files"):
|
||||
project_name = project_name[:-6]
|
||||
params.update({"project_name": project_name})
|
||||
server.send_notification("dynamips.settings", params)
|
||||
|
||||
def allocateServer(self, node_class, use_cloud=False):
|
||||
"""
|
||||
Allocates a server.
|
||||
|
||||
:param node_class: Node object
|
||||
|
||||
:returns: allocated server (WebSocketClient instance)
|
||||
"""
|
||||
|
||||
# allocate a server for the node
|
||||
servers = Servers.instance()
|
||||
|
||||
if use_cloud:
|
||||
from ...topology import Topology
|
||||
topology = Topology.instance()
|
||||
top_instance = topology.anyInstance()
|
||||
server = servers.getCloudServer(top_instance.host, top_instance.port, top_instance.ssl_ca_file)
|
||||
else:
|
||||
if self._settings["use_local_server"]:
|
||||
# use the local server
|
||||
server = servers.localServer()
|
||||
else:
|
||||
# pick up a remote server (round-robin method)
|
||||
server = next(iter(servers))
|
||||
if not server:
|
||||
raise ModuleError("No remote server is configured")
|
||||
return server
|
||||
|
||||
def createNode(self, node_class, server):
|
||||
def createNode(self, node_class, server, project):
|
||||
"""
|
||||
Creates a new node.
|
||||
|
||||
:param node_class: Node object
|
||||
:param server: WebSocketClient instance
|
||||
:param server: HTTPClient instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
log.info("creating node {}".format(node_class))
|
||||
|
||||
if not server.connected():
|
||||
try:
|
||||
log.info("reconnecting to server {}:{}".format(server.host, server.port))
|
||||
server.reconnect()
|
||||
except OSError as e:
|
||||
raise ModuleError("Could not connect to server {}:{}: {}".format(server.host,
|
||||
server.port,
|
||||
e))
|
||||
if server not in self._servers:
|
||||
self.addServer(server)
|
||||
|
||||
# create an instance of the node class
|
||||
return node_class(self, server)
|
||||
return node_class(self, server, project)
|
||||
|
||||
def setupNode(self, node, node_name):
|
||||
"""
|
||||
@@ -428,7 +264,6 @@ class Dynamips(Module):
|
||||
log.info("configuring node {}".format(node))
|
||||
|
||||
if isinstance(node, Router):
|
||||
|
||||
ios_router = None
|
||||
if node_name:
|
||||
for ios_key, info in self._ios_routers.items():
|
||||
@@ -436,63 +271,32 @@ class Dynamips(Module):
|
||||
ios_router = self._ios_routers[ios_key]
|
||||
break
|
||||
|
||||
# hack for EtherSwitch router
|
||||
if isinstance(node, EtherSwitchRouter) and node.server() == Servers.instance().localServer():
|
||||
for info in self._ios_routers.values():
|
||||
if info["platform"] == "c3725" and info["server"] == "local":
|
||||
ios_router = {
|
||||
"platform": "c3725",
|
||||
"path": info["path"],
|
||||
"ram": info["ram"],
|
||||
"startup_config": info["startup_config"],
|
||||
}
|
||||
break
|
||||
if not ios_router:
|
||||
raise ModuleError("Please create an c3725 IOS router in order to use an EtherSwitch router")
|
||||
|
||||
if not ios_router:
|
||||
raise ModuleError("No IOS router for platform {}".format(node.settings()["platform"]))
|
||||
|
||||
settings = {}
|
||||
# set initial settings like the chassis or an Idle-PC value etc.
|
||||
if "chassis" in ios_router and ios_router["chassis"]:
|
||||
settings["chassis"] = ios_router["chassis"]
|
||||
if "idlepc" in ios_router and ios_router["idlepc"]:
|
||||
settings["idlepc"] = ios_router["idlepc"]
|
||||
if ios_router["startup_config"]:
|
||||
settings["startup_config"] = ios_router["startup_config"]
|
||||
if "private_config" in ios_router and ios_router["private_config"]:
|
||||
settings["private_config"] = ios_router["private_config"]
|
||||
vm_settings = {}
|
||||
for setting_name, value in ios_router.items():
|
||||
if setting_name in node.settings() and setting_name != "name" and value != "" and value is not None:
|
||||
vm_settings[setting_name] = value
|
||||
|
||||
if ios_router["platform"] == "c7200":
|
||||
settings["midplane"] = ios_router["midplane"]
|
||||
settings["npe"] = ios_router["npe"]
|
||||
elif "iomem" in ios_router:
|
||||
settings["iomem"] = ios_router["iomem"]
|
||||
base_name = "R"
|
||||
if "slot1" in vm_settings and vm_settings["slot1"] == "NM-16ESW":
|
||||
# must be an EtherSwitch router
|
||||
base_name = "ESW"
|
||||
|
||||
if "nvram" in ios_router and ios_router["nvram"]:
|
||||
settings["nvram"] = ios_router["nvram"]
|
||||
# Older GNS3 versions may have the following invalid settings in the VM template
|
||||
if "console" in vm_settings:
|
||||
del vm_settings["console"]
|
||||
if "sensors" in vm_settings:
|
||||
del vm_settings["sensors"]
|
||||
if "power_supplies" in vm_settings:
|
||||
del vm_settings["power_supplies"]
|
||||
|
||||
if "disk0" in ios_router and ios_router["disk0"]:
|
||||
settings["disk0"] = ios_router["disk0"]
|
||||
|
||||
if "disk1" in ios_router and ios_router["disk1"]:
|
||||
settings["disk1"] = ios_router["disk1"]
|
||||
|
||||
for slot_id in range(0, 7):
|
||||
slot = "slot{}".format(slot_id)
|
||||
if slot in ios_router:
|
||||
settings[slot] = ios_router[slot]
|
||||
for wic_id in range(0, 3):
|
||||
wic = "wic{}".format(wic_id)
|
||||
if wic in ios_router:
|
||||
settings[wic] = ios_router[wic]
|
||||
|
||||
if node.server().isCloud():
|
||||
settings["cloud_path"] = "images/IOS"
|
||||
node.setup(ios_router["image"], ios_router["ram"], initial_settings=settings)
|
||||
else:
|
||||
node.setup(ios_router["path"], ios_router["ram"], initial_settings=settings)
|
||||
ram = vm_settings.pop("ram")
|
||||
image = vm_settings.pop("image", None)
|
||||
if image is None:
|
||||
raise ModuleError("No IOS image has been associated with this IOS router")
|
||||
node.setup(image, ram, additional_settings=vm_settings, base_name=base_name)
|
||||
else:
|
||||
node.setup()
|
||||
|
||||
@@ -505,7 +309,7 @@ class Dynamips(Module):
|
||||
"""
|
||||
|
||||
for ios_router in self._ios_routers.values():
|
||||
if ios_router["path"] == image_path:
|
||||
if os.path.basename(ios_router["image"]) == image_path:
|
||||
if ios_router["idlepc"] != idlepc:
|
||||
ios_router["idlepc"] = idlepc
|
||||
self._saveIOSRouters()
|
||||
@@ -513,36 +317,12 @@ class Dynamips(Module):
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets the servers and nodes.
|
||||
Resets the module.
|
||||
"""
|
||||
|
||||
log.info("Dynamips module reset")
|
||||
for server in self._servers:
|
||||
if server.connected():
|
||||
server.send_notification("dynamips.reset")
|
||||
self._servers.clear()
|
||||
|
||||
for node in self._nodes:
|
||||
node.reset()
|
||||
self._nodes.clear()
|
||||
|
||||
def notification(self, destination, params):
|
||||
"""
|
||||
To received notifications from the server.
|
||||
|
||||
:param destination: JSON-RPC method
|
||||
:param params: JSON-RPC params
|
||||
"""
|
||||
|
||||
if "devices" in params:
|
||||
for node in self._nodes:
|
||||
for device in params["devices"]:
|
||||
if node.name() == device:
|
||||
message = "node {}: {}".format(node.name(), params["message"])
|
||||
self.notification_signal.emit(message, params["details"])
|
||||
if hasattr(node, "stop"):
|
||||
node.stop()
|
||||
|
||||
def exportConfigs(self, directory):
|
||||
"""
|
||||
Exports all configs for all nodes to a directory.
|
||||
@@ -551,8 +331,8 @@ class Dynamips(Module):
|
||||
"""
|
||||
|
||||
for node in self._nodes:
|
||||
if hasattr(node, "exportConfigs") and node.initialized():
|
||||
node.exportConfigs(directory)
|
||||
if isinstance(node, Router) and node.initialized():
|
||||
node.exportConfigToDirectory(directory)
|
||||
|
||||
def importConfigs(self, directory):
|
||||
"""
|
||||
@@ -562,8 +342,8 @@ class Dynamips(Module):
|
||||
"""
|
||||
|
||||
for node in self._nodes:
|
||||
if hasattr(node, "importConfigs") and node.initialized():
|
||||
node.importConfigs(directory)
|
||||
if isinstance(node, Router) and node.initialized():
|
||||
node.importConfigFromDirectory(directory)
|
||||
|
||||
def findAlternativeIOSImage(self, image, node):
|
||||
"""
|
||||
@@ -582,7 +362,7 @@ class Dynamips(Module):
|
||||
mainwindow = MainWindow.instance()
|
||||
ios_routers = self.iosRouters()
|
||||
candidate_ios_images = {}
|
||||
alternative_image = {"path": image,
|
||||
alternative_image = {"image": image,
|
||||
"ram": None,
|
||||
"idlepc": None}
|
||||
|
||||
@@ -592,23 +372,25 @@ class Dynamips(Module):
|
||||
candidate_ios_images[ios_router["image"]] = ios_router
|
||||
|
||||
if candidate_ios_images:
|
||||
selection, ok = QtGui.QInputDialog.getItem(mainwindow,
|
||||
"IOS image", "IOS image {} could not be found\nPlease select an alternative from your existing images:".format(image),
|
||||
list(candidate_ios_images.keys()), 0, False)
|
||||
selection, ok = QtWidgets.QInputDialog.getItem(mainwindow,
|
||||
"IOS image", "IOS image {} could not be found\nPlease select an alternative from your existing images:".format(image),
|
||||
list(candidate_ios_images.keys()), 0, False)
|
||||
if ok:
|
||||
ios_image = candidate_ios_images[selection]
|
||||
alternative_image["path"] = ios_router["path"]
|
||||
ios_image = candidate_ios_images[selection] # FIXME
|
||||
alternative_image["image"] = ios_router["image"]
|
||||
alternative_image["ram"] = ios_router["ram"]
|
||||
alternative_image["idlepc"] = ios_router["idlepc"]
|
||||
self._ios_images_cache[image] = alternative_image
|
||||
return alternative_image
|
||||
|
||||
# no registered IOS image is used, let's just ask for an IOS image path
|
||||
QtGui.QMessageBox.critical(mainwindow, "IOS image", "Could not find the {} IOS image \nPlease select a similar IOS image!".format(image))
|
||||
msg = "Could not find the {} IOS image \nPlease select a similar IOS image!".format(image)
|
||||
log.error(msg)
|
||||
QtWidgets.QMessageBox.critical(mainwindow, "IOS image", msg)
|
||||
from .pages.ios_router_preferences_page import IOSRouterPreferencesPage
|
||||
path = IOSRouterPreferencesPage.getIOSImage(mainwindow)
|
||||
if path:
|
||||
alternative_image["path"] = path
|
||||
image_path = IOSRouterPreferencesPage.getIOSImage(mainwindow, None)
|
||||
if image_path:
|
||||
alternative_image["image"] = image_path
|
||||
self._ios_images_cache[image] = alternative_image
|
||||
return alternative_image
|
||||
|
||||
@@ -642,20 +424,22 @@ class Dynamips(Module):
|
||||
|
||||
server = "local"
|
||||
if not self._settings["use_local_server"]:
|
||||
# pick up a remote server (round-robin method)
|
||||
remote_server = next(iter(Servers.instance()))
|
||||
if remote_server:
|
||||
server = "{}:{}".format(remote_server.host, remote_server.port)
|
||||
if GNS3VM.instance().isRunning():
|
||||
server = "vm"
|
||||
else:
|
||||
# pick up a remote server (round-robin method) #FIXME: review this
|
||||
remote_server = next(iter(Servers.instance()))
|
||||
if remote_server:
|
||||
server = remote_server.url()
|
||||
|
||||
nodes = []
|
||||
for node_class in [EtherSwitchRouter, EthernetSwitch, EthernetHub, FrameRelaySwitch, ATMSwitch]:
|
||||
for node_class in [EthernetSwitch, EthernetHub, FrameRelaySwitch, ATMSwitch]:
|
||||
nodes.append(
|
||||
{"class": node_class.__name__,
|
||||
"name": node_class.symbolName(),
|
||||
"server": server,
|
||||
"categories": node_class.categories(),
|
||||
"default_symbol": node_class.defaultSymbol(),
|
||||
"hover_symbol": node_class.hoverSymbol()}
|
||||
"symbol": node_class.defaultSymbol()}
|
||||
)
|
||||
|
||||
for ios_router in self._ios_routers.values():
|
||||
@@ -663,9 +447,9 @@ class Dynamips(Module):
|
||||
nodes.append(
|
||||
{"class": node_class.__name__,
|
||||
"name": ios_router["name"],
|
||||
"ram": ios_router["ram"],
|
||||
"server": ios_router["server"],
|
||||
"default_symbol": ios_router["default_symbol"],
|
||||
"hover_symbol": ios_router["hover_symbol"],
|
||||
"symbol": ios_router["symbol"],
|
||||
"categories": [ios_router["category"]]}
|
||||
)
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ ADAPTER_MATRIX = {"C1700-MB-1FE": {"nb_ports": 1,
|
||||
"port": FastEthernetPort},
|
||||
|
||||
"C7200-IO-FE": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
"port": FastEthernetPort},
|
||||
"wics": 0,
|
||||
"port": FastEthernetPort},
|
||||
|
||||
"C7200-IO-GE-E": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
@@ -125,4 +125,4 @@ ADAPTER_MATRIX = {"C1700-MB-1FE": {"nb_ports": 1,
|
||||
"PA-POS-OC3": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
"port": POSPort},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,20 @@
|
||||
Wizard for IOS routers.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from gns3.servers import Servers
|
||||
from gns3.utils.message_box import MessageBox
|
||||
from gns3.node import Node
|
||||
from gns3.gns3_vm import GNS3VM
|
||||
from gns3.utils.run_in_terminal import RunInTerminal
|
||||
from gns3.utils.get_resource import get_resource
|
||||
from gns3.utils.get_default_base_config import get_default_base_config
|
||||
from gns3.dialogs.vm_wizard import VMWizard
|
||||
|
||||
from ....settings import ENABLE_CLOUD
|
||||
from ..ui.ios_router_wizard_ui import Ui_IOSRouterWizard
|
||||
from ..settings import PLATFORMS_DEFAULT_RAM, CHASSIS, ADAPTER_MATRIX, WIC_MATRIX
|
||||
from ..settings import PLATFORMS_DEFAULT_RAM, PLATFORMS_DEFAULT_NVRAM, CHASSIS, ADAPTER_MATRIX, WIC_MATRIX
|
||||
from .. import Dynamips
|
||||
from ..nodes.c1700 import C1700
|
||||
from ..nodes.c2600 import C2600
|
||||
@@ -50,8 +52,12 @@ PLATFORM_TO_CLASS = {
|
||||
"c7200": C7200
|
||||
}
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IOSRouterWizard(VMWizard, Ui_IOSRouterWizard):
|
||||
|
||||
class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
"""
|
||||
Wizard to create an IOS router.
|
||||
|
||||
@@ -61,23 +67,30 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
|
||||
def __init__(self, ios_routers, parent):
|
||||
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/router.normal.svg"))
|
||||
self.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
if sys.platform.startswith("darwin"):
|
||||
# we want to see the cancel button on OSX
|
||||
self.setOptions(QtGui.QWizard.NoDefaultButton)
|
||||
super().__init__(parent)
|
||||
self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/router.svg"))
|
||||
|
||||
self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
|
||||
self.uiLoadBalanceCheckBox.toggled.connect(self._loadBalanceToggledSlot)
|
||||
self.uiIOSImageToolButton.clicked.connect(self._iosImageBrowserSlot)
|
||||
self.uiTestIOSImagePushButton.clicked.connect(self._testIOSImageSlot)
|
||||
self.uiIdlePCFinderPushButton.clicked.connect(self._idlePCFinderSlot)
|
||||
self.uiEtherSwitchCheckBox.stateChanged.connect(self._etherSwitchSlot)
|
||||
self.uiPlatformComboBox.currentIndexChanged[str].connect(self._platformChangedSlot)
|
||||
self.uiPlatformComboBox.addItems(list(PLATFORMS_DEFAULT_RAM.keys()))
|
||||
|
||||
#FIXME: hide because of issue on Windows.
|
||||
self._router = None
|
||||
# Validate the Idle PC value
|
||||
self._idle_valid = False
|
||||
idle_pc_rgx = QtCore.QRegExp("^(0x[0-9a-fA-F]{8})?$")
|
||||
validator = QtGui.QRegExpValidator(idle_pc_rgx, self)
|
||||
self.uiIdlepcLineEdit.setValidator(validator)
|
||||
self.uiIdlepcLineEdit.textChanged.connect(self._idlePCValidateSlot)
|
||||
self.uiIdlepcLineEdit.textChanged.emit(self.uiIdlepcLineEdit.text())
|
||||
|
||||
# location of the base config templates
|
||||
self._base_startup_config_template = get_resource(os.path.join("configs", "ios_base_startup-config.txt"))
|
||||
self._base_private_config_template = get_resource(os.path.join("configs", "ios_base_private-config.txt"))
|
||||
self._base_etherswitch_startup_config_template = get_resource(os.path.join("configs", "ios_etherswitch_startup-config.txt"))
|
||||
|
||||
# FIXME: hide because of issue on Windows.
|
||||
self.uiTestIOSImagePushButton.hide()
|
||||
|
||||
# Mandatory fields
|
||||
@@ -102,134 +115,18 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
# skip the server page if we use the local server
|
||||
self.setStartId(1)
|
||||
|
||||
if not ENABLE_CLOUD:
|
||||
self.uiCloudRadioButton.hide()
|
||||
|
||||
|
||||
def _remoteServerToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the remote server radio button is toggled.
|
||||
|
||||
:param checked: either the button is checked or not
|
||||
"""
|
||||
|
||||
if checked:
|
||||
self.uiRemoteServersGroupBox.setEnabled(True)
|
||||
else:
|
||||
self.uiRemoteServersGroupBox.setEnabled(False)
|
||||
|
||||
def _loadBalanceToggledSlot(self, checked):
|
||||
"""
|
||||
Slot for when the load balance checkbox is toggled.
|
||||
|
||||
:param checked: either the box is checked or not
|
||||
"""
|
||||
|
||||
if checked:
|
||||
self.uiRemoteServersComboBox.setEnabled(False)
|
||||
else:
|
||||
self.uiRemoteServersComboBox.setEnabled(True)
|
||||
|
||||
def _platformChangedSlot(self, platform):
|
||||
"""
|
||||
Updates the chassis comboBox based on the selected platform.
|
||||
|
||||
:param platform: selected router platform
|
||||
"""
|
||||
|
||||
self.uiChassisComboBox.clear()
|
||||
if platform in CHASSIS:
|
||||
self.uiChassisComboBox.addItems(CHASSIS[platform])
|
||||
|
||||
def _testIOSImageSlot(self):
|
||||
"""
|
||||
Slot to locally test the IOS image.
|
||||
"""
|
||||
|
||||
platform = self.uiPlatformComboBox.currentText()
|
||||
ram = self.uiRamSpinBox.value()
|
||||
ios_image = self.uiIOSImageLineEdit.text()
|
||||
dynamips = os.path.realpath(Dynamips.instance().settings()["path"])
|
||||
if not os.path.exists(dynamips):
|
||||
QtGui.QMessageBox.critical(self, "IOS image", "Could not find Dynamips executable: {}".format(dynamips))
|
||||
return
|
||||
command = '"{path}" -P {platform} -r {ram} "{ios_image}"'.format(path=dynamips,
|
||||
platform=platform[1:],
|
||||
ram=ram,
|
||||
ios_image=ios_image)
|
||||
try:
|
||||
RunInTerminal(command)
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(self, "IOS image", "Could not test the IOS image: {}".format(e))
|
||||
|
||||
def _idlePCFinderSlot(self):
|
||||
"""
|
||||
Slot for the idle-PC finder.
|
||||
"""
|
||||
|
||||
server = Servers.instance().localServer()
|
||||
module = Dynamips.instance()
|
||||
platform = self.uiPlatformComboBox.currentText()
|
||||
ios_image = self.uiIOSImageLineEdit.text()
|
||||
ram = self.uiRamSpinBox.value()
|
||||
router_class = PLATFORM_TO_CLASS[platform]
|
||||
self._router = router_class(module, server)
|
||||
self._router.setup(ios_image, ram, name="AUTOIDLEPC")
|
||||
self._router.created_signal.connect(self.createdSlot)
|
||||
self.uiIdlePCFinderPushButton.setEnabled(False)
|
||||
|
||||
def createdSlot(self, node_id):
|
||||
"""
|
||||
The node for the auto Idle-PC has been created.
|
||||
|
||||
:param node_id: not used
|
||||
"""
|
||||
|
||||
self._router.computeAutoIdlepc(self._computeAutoIdlepcCallback)
|
||||
self._auto_idlepc_progress_dialog = QtGui.QProgressDialog("Searching for an Idle-PC value...", "Cancel", 0, 0, parent=self)
|
||||
self._auto_idlepc_progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
self._auto_idlepc_progress_dialog.setWindowTitle("Idle-PC finder")
|
||||
self._auto_idlepc_progress_dialog.show()
|
||||
|
||||
def _computeAutoIdlepcCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for computeAutoIdlepc.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
self._router.delete()
|
||||
if self._auto_idlepc_progress_dialog.wasCanceled():
|
||||
return
|
||||
self._auto_idlepc_progress_dialog.accept()
|
||||
|
||||
if error:
|
||||
QtGui.QMessageBox.critical(self, "Idle-PC finder", "Error: ".format(result["message"]))
|
||||
else:
|
||||
if result["idlepc"] and result["idlepc"] != "0x0":
|
||||
self.uiIdlepcLineEdit.setText(result["idlepc"])
|
||||
else:
|
||||
logs = "\n".join(result["logs"])
|
||||
MessageBox(self, "Idle-PC finder", "Could not find an Idle-PC value", details=logs)
|
||||
|
||||
def _iosImageBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select an IOU image.
|
||||
"""
|
||||
|
||||
from ..pages.ios_router_preferences_page import IOSRouterPreferencesPage
|
||||
path = IOSRouterPreferencesPage.getIOSImage(self)
|
||||
if not path:
|
||||
return
|
||||
self.uiIOSImageLineEdit.clear()
|
||||
self.uiIOSImageLineEdit.setText(path)
|
||||
self.addImageSelector(self.uiIOSExistingImageRadioButton, self.uiIOSImageListComboBox, self.uiIOSImageLineEdit, self.uiIOSImageToolButton, IOSRouterPreferencesPage.getIOSImage)
|
||||
|
||||
def _prefillPlatform(self):
|
||||
"""
|
||||
Try to guess the platform based on image name
|
||||
"""
|
||||
# try to guess the platform
|
||||
image = os.path.basename(path)
|
||||
match = re.match("^(c[0-9]+)\\-\w+", image.lower())
|
||||
image = os.path.basename(self.uiIOSImageLineEdit.text())
|
||||
match = re.match("^(c[0-9]+)p?\\-\w+", image.lower())
|
||||
if not match:
|
||||
QtGui.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
|
||||
return
|
||||
|
||||
detected_platform = match.group(1)
|
||||
@@ -242,9 +139,12 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
break
|
||||
|
||||
if detected_platform not in PLATFORMS_DEFAULT_RAM:
|
||||
QtGui.QMessageBox.warning(self, "IOS image", "This IOS image is for the {} platform/chassis and is not supported by this application!".format(detected_platform))
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "This IOS image is for the {} platform/chassis and is not supported by this application!".format(detected_platform))
|
||||
return
|
||||
|
||||
if image.lower().startswith("c7200p"):
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "This IOS image is for c7200 PowerPC routers and is not recommended. Please use an IOS image that do not start with c7200p.")
|
||||
|
||||
index = self.uiPlatformComboBox.findText(detected_platform)
|
||||
if index != -1:
|
||||
self.uiPlatformComboBox.setCurrentIndex(index)
|
||||
@@ -253,6 +153,182 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
if index != -1:
|
||||
self.uiChassisComboBox.setCurrentIndex(index)
|
||||
|
||||
def _platformChangedSlot(self, platform):
|
||||
"""
|
||||
Updates the chassis comboBox based on the selected platform.
|
||||
|
||||
:param platform: selected router platform
|
||||
"""
|
||||
|
||||
self.uiChassisComboBox.clear()
|
||||
if platform in CHASSIS:
|
||||
self.uiChassisComboBox.addItems(CHASSIS[platform])
|
||||
if platform not in ("c2600", "c3600", "c2691", "c3725", "c3745"):
|
||||
self.uiEtherSwitchCheckBox.setChecked(False)
|
||||
self.uiEtherSwitchCheckBox.hide()
|
||||
else:
|
||||
self.uiEtherSwitchCheckBox.show()
|
||||
|
||||
def _testIOSImageSlot(self):
|
||||
"""
|
||||
Slot to locally test the IOS image.
|
||||
"""
|
||||
|
||||
platform = self.uiPlatformComboBox.currentText()
|
||||
ram = self.uiRamSpinBox.value()
|
||||
ios_image = self.uiIOSImageLineEdit.text()
|
||||
dynamips = os.path.realpath(Dynamips.instance().settings()["image"])
|
||||
if not os.path.exists(dynamips):
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "Could not find Dynamips executable: {}".format(dynamips))
|
||||
return
|
||||
command = '"{path}" -P {platform} -r {ram} "{ios_image}"'.format(path=dynamips,
|
||||
platform=platform[1:],
|
||||
ram=ram,
|
||||
ios_image=ios_image)
|
||||
try:
|
||||
RunInTerminal(command)
|
||||
except OSError as e:
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "Could not test the IOS image: {}".format(e))
|
||||
|
||||
def _idlePCValidateSlot(self):
|
||||
"""
|
||||
Slot to validate the entered Idle-PC Value
|
||||
"""
|
||||
|
||||
validator = self.uiIdlepcLineEdit.validator()
|
||||
text_input = self.uiIdlepcLineEdit.text()
|
||||
state = validator.validate(text_input, len(text_input))[0]
|
||||
if state == QtGui.QValidator.Acceptable:
|
||||
color = '#A2C964' # green
|
||||
self._idle_valid = True
|
||||
elif state == QtGui.QValidator.Intermediate:
|
||||
color = '#fff79a' # yellow
|
||||
self._idle_valid = False
|
||||
else:
|
||||
color = '#f6989d' # red
|
||||
self._idle_valid = False
|
||||
self.uiIdlepcLineEdit.setStyleSheet('QLineEdit { background-color: %s }' % color)
|
||||
|
||||
def _idlePCFinderSlot(self):
|
||||
"""
|
||||
Slot for the idle-PC finder.
|
||||
"""
|
||||
|
||||
from gns3.main_window import MainWindow
|
||||
main_window = MainWindow.instance()
|
||||
server = Servers.instance().getServerFromString(self.getSettings()["server"])
|
||||
module = Dynamips.instance()
|
||||
platform = self.uiPlatformComboBox.currentText()
|
||||
ios_image = self.uiIOSImageLineEdit.text()
|
||||
ram = self.uiRamSpinBox.value()
|
||||
router_class = PLATFORM_TO_CLASS[platform]
|
||||
self._router = router_class(module, server, main_window.project())
|
||||
self._router.setup(ios_image, ram, name="AUTOIDLEPC")
|
||||
self._router.created_signal.connect(self.createdSlot)
|
||||
self._router.server_error_signal.connect(self.serverErrorSlot)
|
||||
self.uiIdlePCFinderPushButton.setEnabled(False)
|
||||
|
||||
def _etherSwitchSlot(self, state):
|
||||
"""
|
||||
Slot if the EtherSwitch option is chosen or not.
|
||||
:param state: boolean
|
||||
"""
|
||||
|
||||
if state:
|
||||
# forces the name to EtherSwitch
|
||||
self.uiNameLineEdit.setText("EtherSwitch router")
|
||||
# self.uiNameLineEdit.setEnabled(False)
|
||||
else:
|
||||
self.uiNameLineEdit.setText(self.uiPlatformComboBox.currentText())
|
||||
# self.uiNameLineEdit.setEnabled(True)
|
||||
|
||||
def createdSlot(self, node_id):
|
||||
"""
|
||||
The node for the auto Idle-PC has been created.
|
||||
|
||||
:param node_id: not used
|
||||
"""
|
||||
|
||||
self._router.computeAutoIdlepc(self._computeAutoIdlepcCallback)
|
||||
|
||||
def serverErrorSlot(self, node_id, message):
|
||||
"""
|
||||
The auto idle-pc node could not be created.
|
||||
|
||||
:param node_id: not used
|
||||
:param message: error message from the server.
|
||||
"""
|
||||
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC finder", "Could not create IOS router: {}".format(message))
|
||||
|
||||
def _computeAutoIdlepcCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for computeAutoIdlepc.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if self._router:
|
||||
self._router.delete()
|
||||
self._router = None
|
||||
if error:
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC finder", "Error: {}".format(result["message"]))
|
||||
else:
|
||||
idlepc = result["idlepc"]
|
||||
self.uiIdlepcLineEdit.setText(idlepc)
|
||||
QtWidgets.QMessageBox.information(self, "Idle-PC finder", "Idle-PC value {} has been found suitable for your IOS image".format(idlepc))
|
||||
|
||||
def _iosImageBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select an IOU image.
|
||||
"""
|
||||
|
||||
from ..pages.ios_router_preferences_page import IOSRouterPreferencesPage
|
||||
server = Servers.instance().getServerFromString(self.getSettings()["server"])
|
||||
path = IOSRouterPreferencesPage.getIOSImage(self, server)
|
||||
if not path:
|
||||
return
|
||||
self.uiIOSImageLineEdit.clear()
|
||||
self.uiIOSImageLineEdit.setText(path)
|
||||
|
||||
# try to guess the platform
|
||||
image = os.path.basename(path)
|
||||
match = re.match("^(c[0-9]+)p?\\-\w+", image.lower())
|
||||
if not match:
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
|
||||
return
|
||||
|
||||
detected_platform = match.group(1)
|
||||
detected_chassis = ""
|
||||
# IOS images for the 3600 platform start with the chassis name (c3620 etc.)
|
||||
for platform, chassis in CHASSIS.items():
|
||||
if detected_platform[1:] in chassis:
|
||||
detected_chassis = detected_platform[1:]
|
||||
detected_platform = platform
|
||||
break
|
||||
|
||||
if detected_platform not in PLATFORMS_DEFAULT_RAM:
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "This IOS image is for the {} platform/chassis and is not supported by this application!".format(detected_platform))
|
||||
return
|
||||
|
||||
if image.lower().startswith("c7200p"):
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "This IOS image is for c7200 PowerPC routers and is not recommended. Please use an IOS image that do not start with c7200p.")
|
||||
|
||||
index = self.uiPlatformComboBox.findText(detected_platform)
|
||||
if index != -1:
|
||||
self.uiPlatformComboBox.setCurrentIndex(index)
|
||||
|
||||
index = self.uiChassisComboBox.findText(detected_chassis)
|
||||
if index != -1:
|
||||
self.uiChassisComboBox.setCurrentIndex(index)
|
||||
|
||||
def done(self, result):
|
||||
|
||||
if self._router:
|
||||
self._router.delete()
|
||||
super().done(result)
|
||||
|
||||
def _populateAdapters(self, platform, chassis):
|
||||
"""
|
||||
Loads the adapter and WIC configuration.
|
||||
@@ -270,7 +346,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
for slot_number, slot_adapters in ADAPTER_MATRIX[platform][chassis].items():
|
||||
self._widget_slots[slot_number].setEnabled(True)
|
||||
|
||||
if type(slot_adapters) == str:
|
||||
if isinstance(slot_adapters, str):
|
||||
# only one default adapter for this slot.
|
||||
self._widget_slots[slot_number].addItem(slot_adapters)
|
||||
else:
|
||||
@@ -292,12 +368,14 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
|
||||
def initializePage(self, page_id):
|
||||
|
||||
if self.page(page_id) == self.uiServerWizardPage:
|
||||
self.uiRemoteServersComboBox.clear()
|
||||
for server in Servers.instance().remoteServers().values():
|
||||
self.uiRemoteServersComboBox.addItem("{}:{}".format(server.host, server.port), server)
|
||||
super().initializePage(page_id)
|
||||
|
||||
if self.page(page_id) == self.uiServerWizardPage and GNS3VM.instance().isRunning():
|
||||
self.uiVMRadioButton.setChecked(True)
|
||||
elif self.page(page_id) == self.uiIOSImageWizardPage:
|
||||
self.loadImagesList("/dynamips/vms")
|
||||
elif self.page(page_id) == self.uiNamePlatformWizardPage:
|
||||
self._prefillPlatform()
|
||||
self.uiNameLineEdit.setText(self.uiPlatformComboBox.currentText())
|
||||
ios_image = self.uiIOSImageLineEdit.text()
|
||||
self.setWindowTitle("New IOS router - {}".format(os.path.basename(ios_image)))
|
||||
@@ -308,7 +386,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
path = self.uiIOSImageLineEdit.text()
|
||||
if os.path.isfile(path):
|
||||
minimum_required_ram = IOSRouterPreferencesPage.getMinimumRequiredRAM(path)
|
||||
if minimum_required_ram > PLATFORMS_DEFAULT_RAM[platform]:
|
||||
if minimum_required_ram >= PLATFORMS_DEFAULT_RAM[platform]:
|
||||
self.uiRamSpinBox.setValue(minimum_required_ram)
|
||||
else:
|
||||
self.uiRamSpinBox.setValue(PLATFORMS_DEFAULT_RAM[platform])
|
||||
@@ -323,35 +401,40 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
self._populateAdapters(platform, chassis)
|
||||
if platform == "c7200":
|
||||
self.uiSlot0comboBox.setCurrentIndex(self.uiSlot0comboBox.findText("C7200-IO-FE"))
|
||||
if self.uiEtherSwitchCheckBox.isChecked():
|
||||
self.uiSlot1comboBox.setCurrentIndex(self.uiSlot1comboBox.findText("NM-16ESW"))
|
||||
|
||||
elif self.page(page_id) == self.uiIdlePCWizardPage:
|
||||
path = self.uiIOSImageLineEdit.text()
|
||||
idle_pc = Dynamips.getDefaultIdlePC(path)
|
||||
if idle_pc is not None:
|
||||
self.uiIdlepcLineEdit.setText(idle_pc)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
"""
|
||||
Validates the IOS name.
|
||||
Validates the IOS name and checks validation state for Idle-PC value
|
||||
"""
|
||||
|
||||
if super().validateCurrentPage() is False:
|
||||
return False
|
||||
|
||||
if self.currentPage() == self.uiNamePlatformWizardPage:
|
||||
name = self.uiNameLineEdit.text()
|
||||
for ios_router in self._ios_routers.values():
|
||||
if ios_router["name"] == name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "{} is already used, please choose another name".format(name))
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "{} is already used, please choose another name".format(name))
|
||||
return False
|
||||
if self.currentPage() == self.uiMemoryWizardPage and self.uiPlatformComboBox.currentText() == "c7200":
|
||||
if self.uiRamSpinBox.value() > 512:
|
||||
QtWidgets.QMessageBox.critical(self, "c7200 RAM requirement", "c7200 routers with NPE-400 are limited to 512MB of RAM")
|
||||
return False
|
||||
if self.currentPage() == self.uiIdlePCWizardPage:
|
||||
if not self._idle_valid:
|
||||
idle_pc = self.uiIdlepcLineEdit.text()
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC", "{} is not a valid Idle-PC value ".format(idle_pc))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
# minimum_required_ram = self._getMinimumRequiredRAM(path)
|
||||
# if minimum_required_ram > ram:
|
||||
# QtGui.QMessageBox.warning(self, "IOS image", "There is not sufficient RAM allocated to this IOS image, recommended RAM is {} MB".format(minimum_required_ram))
|
||||
#
|
||||
# # basename doesn't work on Unix with Windows paths
|
||||
# if not sys.platform.startswith('win') and len(path) > 2 and path[1] == ":":
|
||||
# import ntpath
|
||||
# image = ntpath.basename(path)
|
||||
# else:
|
||||
# image = os.path.basename(path)
|
||||
#
|
||||
# if image.startswith("c7200p"):
|
||||
# QtGui.QMessageBox.warning(self, "IOS image", "This IOS image is for the c7200 platform with NPE-G2 and using it is not recommended.\nPlease use an IOS image that do not start with c7200p.")
|
||||
|
||||
def getSettings(self):
|
||||
"""
|
||||
Returns the settings set in this Wizard.
|
||||
@@ -359,32 +442,42 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
:return: settings dict
|
||||
"""
|
||||
|
||||
path = self.uiIOSImageLineEdit.text()
|
||||
image = self.uiIOSImageLineEdit.text()
|
||||
if Dynamips.instance().settings()["use_local_server"] or self.uiLocalRadioButton.isChecked():
|
||||
server = "local"
|
||||
elif self.uiRemoteRadioButton.isChecked():
|
||||
if self.uiLoadBalanceCheckBox.isChecked():
|
||||
server = next(iter(Servers.instance()))
|
||||
if not server:
|
||||
QtGui.QMessageBox.critical(self, "IOS router", "No remote server available!")
|
||||
return
|
||||
server = "{}:{}".format(server.host, server.port)
|
||||
server = "load-balance"
|
||||
else:
|
||||
server = self.uiRemoteServersComboBox.currentText()
|
||||
else: # Cloud is selected
|
||||
server = "cloud"
|
||||
elif self.uiVMRadioButton.isChecked():
|
||||
server = "vm"
|
||||
|
||||
platform = self.uiPlatformComboBox.currentText()
|
||||
settings = {
|
||||
"name": self.uiNameLineEdit.text(),
|
||||
"path": path,
|
||||
"image": image,
|
||||
"startup_config": get_default_base_config(self._base_startup_config_template),
|
||||
"ram": self.uiRamSpinBox.value(),
|
||||
"nvram": PLATFORMS_DEFAULT_NVRAM[platform],
|
||||
"idlepc": self.uiIdlepcLineEdit.text(),
|
||||
"image": os.path.basename(path),
|
||||
"platform": self.uiPlatformComboBox.currentText(),
|
||||
"platform": platform,
|
||||
"chassis": self.uiChassisComboBox.currentText(),
|
||||
"server": server,
|
||||
}
|
||||
|
||||
if self.uiEtherSwitchCheckBox.isChecked():
|
||||
settings["startup_config"] = get_default_base_config(self._base_etherswitch_startup_config_template)
|
||||
settings["symbol"] = ":/symbols/multilayer_switch.svg"
|
||||
settings["disk0"] = 1 # adds 1MB disk to store vlan.dat
|
||||
settings["category"] = Node.switches
|
||||
else:
|
||||
settings["auto_delete_disks"] = True
|
||||
|
||||
image_file = os.path.basename(image)
|
||||
if image_file.lower().startswith("c7200p"):
|
||||
settings["npe"] = "npe-g2"
|
||||
|
||||
for slot_id, widget in self._widget_slots.items():
|
||||
if widget.isEnabled():
|
||||
settings["slot{}".format(slot_id)] = widget.currentText()
|
||||
@@ -406,4 +499,4 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
if platform not in WIC_MATRIX:
|
||||
# skip the WIC modules page if the platform doesn't support any.
|
||||
return self.uiNetworkAdaptersWizardPage.nextId() + 1
|
||||
return QtGui.QWizard.nextId(self)
|
||||
return QtWidgets.QWizard.nextId(self)
|
||||
|
||||
@@ -23,35 +23,36 @@ Asynchronously sends JSON messages to the GNS3 server and receives responses wit
|
||||
import re
|
||||
from gns3.node import Node
|
||||
from gns3.ports.atm_port import ATMPort
|
||||
from .device import Device
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ATMSwitch(Node):
|
||||
class ATMSwitch(Device):
|
||||
|
||||
"""
|
||||
Dynamips ATM switch.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Node.__init__(self, server)
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
log.info("ATM switch is being created")
|
||||
super().__init__(module, server, project)
|
||||
self.setStatus(Node.started) # this is an always-on node
|
||||
self._atmsw_id = None
|
||||
self._ports = []
|
||||
self._module = module
|
||||
self._settings = {"name": "",
|
||||
"mappings": {}}
|
||||
|
||||
def setup(self, name=None, initial_ports=[], initial_mappings={}):
|
||||
def setup(self, name=None, device_id=None, initial_ports=[], initial_mappings={}):
|
||||
"""
|
||||
Setups this ATM switch.
|
||||
|
||||
:param name: optional name for this switch.
|
||||
:param device_id: device identifier on the server
|
||||
:param initial_ports: ports to be automatically added when creating this ATM switch
|
||||
:param initial_mappings: mappings to be automatically added when creating this ATM switch
|
||||
"""
|
||||
@@ -78,61 +79,11 @@ class ATMSwitch(Node):
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
|
||||
params = {"name": name}
|
||||
self._server.send_message("dynamips.atmsw.create", params, self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while setting up {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
self._atmsw_id = result["id"]
|
||||
if not self._atmsw_id:
|
||||
self.error_signal.emit(self.id(), "returned ID from server is null")
|
||||
return
|
||||
|
||||
self._settings["name"] = result["name"]
|
||||
log.info("ATM switch {} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
self.created_signal.emit(self.id())
|
||||
self._module.addNode(self)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this ATM switch.
|
||||
"""
|
||||
|
||||
log.debug("ATM switch {} is being deleted".format(self.name()))
|
||||
# first delete all the links attached to this node
|
||||
self.delete_links_signal.emit()
|
||||
if self._atmsw_id:
|
||||
self._server.send_message("dynamips.atmsw.delete", {"id": self._atmsw_id}, self._deleteCallback)
|
||||
else:
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _deleteCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for delete.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
log.info("ATM switch {} has been deleted".format(self.name()))
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
params = {"name": name,
|
||||
"device_type": "atm_switch"}
|
||||
if device_id:
|
||||
params["device_id"] = device_id
|
||||
self.httpPost("/dynamips/devices", self._setupCallback, body=params)
|
||||
|
||||
def update(self, new_settings):
|
||||
"""
|
||||
@@ -141,53 +92,54 @@ class ATMSwitch(Node):
|
||||
:param new_settings: settings dictionary
|
||||
"""
|
||||
|
||||
ports_to_create = []
|
||||
mapping = new_settings["mappings"]
|
||||
|
||||
updated = False
|
||||
for source, destination in mapping.items():
|
||||
source_port = source.split(":")[0]
|
||||
destination_port = destination.split(":")[0]
|
||||
if source_port not in ports_to_create:
|
||||
ports_to_create.append(source_port)
|
||||
if destination_port not in ports_to_create:
|
||||
ports_to_create.append(destination_port)
|
||||
if "mappings" in new_settings:
|
||||
ports_to_create = []
|
||||
mapping = new_settings["mappings"]
|
||||
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
for source, destination in mapping.items():
|
||||
source_port = source.split(":")[0]
|
||||
destination_port = destination.split(":")[0]
|
||||
if source_port not in ports_to_create:
|
||||
ports_to_create.append(source_port)
|
||||
if destination_port not in ports_to_create:
|
||||
ports_to_create.append(destination_port)
|
||||
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
updated = True
|
||||
self._ports.remove(port)
|
||||
else:
|
||||
ports_to_create.remove(port.name())
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = ATMPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(ATMPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
self._ports.remove(port)
|
||||
else:
|
||||
ports_to_create.remove(port.name())
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = ATMPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(ATMPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
self._settings["mappings"] = new_settings["mappings"].copy()
|
||||
|
||||
params = {}
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
if self.hasAllocatedName(new_settings["name"]):
|
||||
self.error_signal.emit(self.id(), 'Name "{}" is already used by another node'.format(new_settings["name"]))
|
||||
return
|
||||
params = {"id": self._atmsw_id,
|
||||
"name": new_settings["name"]}
|
||||
params["name"] = new_settings["name"]
|
||||
updated = True
|
||||
|
||||
self._settings["mappings"] = new_settings["mappings"].copy()
|
||||
if updated:
|
||||
if params:
|
||||
log.debug("{} is being updated: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.atmsw.update", params, self._updateCallback)
|
||||
self.httpPut("/dynamips/devices/{device_id}".format(device_id=self._device_id), self._updateCallback, body=params)
|
||||
else:
|
||||
log.info("ATM switch {} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def _updateCallback(self, result, error=False):
|
||||
def _updateCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for update.
|
||||
|
||||
@@ -197,7 +149,7 @@ class ATMSwitch(Node):
|
||||
|
||||
if error:
|
||||
log.error("error while updating {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
if "name" in result:
|
||||
self._settings["name"] = result["name"]
|
||||
@@ -205,33 +157,6 @@ class ATMSwitch(Node):
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def allocateUDPPort(self, port_id):
|
||||
"""
|
||||
Requests an UDP port allocation.
|
||||
|
||||
:param port_id: port identifier
|
||||
"""
|
||||
|
||||
log.debug("{} is requesting an UDP port allocation".format(self.name()))
|
||||
self._server.send_message("dynamips.atmsw.allocate_udp_port", {"id": self._atmsw_id, "port_id": port_id}, self._allocateUDPPortCallback)
|
||||
|
||||
def _allocateUDPPortCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for allocateUDPPort.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
port_id = result["port_id"]
|
||||
lport = result["lport"]
|
||||
log.debug("{} has allocated UDP port {}".format(self.name(), lport))
|
||||
self.allocate_udp_nio_signal.emit(self.id(), port_id, lport)
|
||||
|
||||
def addNIO(self, port, nio):
|
||||
"""
|
||||
Adds a new NIO on the specified port for this ATM switch.
|
||||
@@ -240,11 +165,7 @@ class ATMSwitch(Node):
|
||||
:param nio: NIO instance
|
||||
"""
|
||||
|
||||
params = {"id": self._atmsw_id,
|
||||
"port": port.portNumber(),
|
||||
"port_id": port.id()}
|
||||
|
||||
params["nio"] = self.getNIOInfo(nio)
|
||||
params = {"nio": self.getNIOInfo(nio)}
|
||||
params["mappings"] = {}
|
||||
for source, destination in self._settings["mappings"].items():
|
||||
source_port = source.split(":")[0]
|
||||
@@ -255,124 +176,13 @@ class ATMSwitch(Node):
|
||||
params["mappings"][destination] = source
|
||||
|
||||
log.debug("{} is adding an {}: {}".format(self.name(), nio, params))
|
||||
self._server.send_message("dynamips.atmsw.add_nio", params, self._addNIOCallback)
|
||||
|
||||
def _addNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for addNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.nio_cancel_signal.emit(self.id())
|
||||
else:
|
||||
log.debug("{} has added a new NIO: {}".format(self.name(), result))
|
||||
self.nio_signal.emit(self.id(), result["port_id"])
|
||||
|
||||
def deleteNIO(self, port):
|
||||
"""
|
||||
Deletes an NIO from the specified port on this switch.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._atmsw_id,
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is deleting an NIO: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.atmsw.delete_nio", params, self.deleteNIOCallback)
|
||||
|
||||
def deleteNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for deleteNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting NIO {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
log.debug("{} has deleted a NIO: {}".format(self.name(), result))
|
||||
|
||||
def startPacketCapture(self, port, capture_file_name, data_link_type):
|
||||
"""
|
||||
Starts a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
:param capture_file_name: PCAP capture file path
|
||||
:param data_link_type: PCAP data link type
|
||||
"""
|
||||
|
||||
params = {"id": self._atmsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber(),
|
||||
"capture_file_name": capture_file_name,
|
||||
"data_link_type": data_link_type}
|
||||
|
||||
log.debug("{} is starting a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.atmsw.start_capture", params, self._startPacketCaptureCallback)
|
||||
|
||||
def _startPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for starting a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while starting capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully started capturing packets on {}".format(self.name(), port.name()))
|
||||
try:
|
||||
port.startPacketCapture(result["capture_file_path"])
|
||||
except OSError as e:
|
||||
self.error_signal.emit(self.id(), "could not start the packet capture reader: {}: {}".format(e, e.filename))
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
|
||||
def stopPacketCapture(self, port):
|
||||
"""
|
||||
Stops a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._atmsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is stopping a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.atmsw.stop_capture", params, self._stopPacketCaptureCallback)
|
||||
|
||||
def _stopPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for stopping a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while stopping capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully stopped capturing packets on {}".format(self.name(), port.name()))
|
||||
port.stopPacketCapture()
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/nio".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._addNIOCallback,
|
||||
context={"port_id": port.id()},
|
||||
body=params)
|
||||
|
||||
def info(self):
|
||||
"""
|
||||
@@ -382,14 +192,15 @@ class ATMSwitch(Node):
|
||||
"""
|
||||
|
||||
info = """ATM switch {name} is always-on
|
||||
Node ID is {id}, server's ATM switch ID is {atmsw_id}
|
||||
Local node ID is {id}
|
||||
Server's Device ID is {device_id}
|
||||
Hardware is Dynamips emulated simple ATM switch
|
||||
Switch's server runs on {host}:{port}
|
||||
""".format(name=self.name(),
|
||||
id=self.id(),
|
||||
atmsw_id=self._atmsw_id,
|
||||
host=self._server.host,
|
||||
port=self._server.port)
|
||||
device_id=self._device_id,
|
||||
host=self._server.host(),
|
||||
port=self._server.port())
|
||||
|
||||
port_info = ""
|
||||
mapping = re.compile(r"""^([0-9]*):([0-9]*):([0-9]*)$""")
|
||||
@@ -449,11 +260,11 @@ class ATMSwitch(Node):
|
||||
"""
|
||||
|
||||
atmsw = {"id": self.id(),
|
||||
"device_id": self._device_id,
|
||||
"type": self.__class__.__name__,
|
||||
"description": str(self),
|
||||
"properties": {"name": self.name()},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
"server_id": self._server.id()}
|
||||
|
||||
if self._settings["mappings"]:
|
||||
atmsw["properties"]["mappings"] = self._settings["mappings"]
|
||||
@@ -477,6 +288,10 @@ class ATMSwitch(Node):
|
||||
settings = node_info["properties"]
|
||||
name = settings.pop("name")
|
||||
|
||||
# pre-1.3 projects have no device id, set to 1 to have
|
||||
# a proper project conversion on the server side
|
||||
device_id = node_info.get("device_id", 1)
|
||||
|
||||
mappings = {}
|
||||
if "mappings" in settings:
|
||||
mappings = settings["mappings"]
|
||||
@@ -487,7 +302,7 @@ class ATMSwitch(Node):
|
||||
|
||||
log.info("ATM switch {} is loading".format(name))
|
||||
self.setName(name)
|
||||
self.setup(name, ports, mappings)
|
||||
self.setup(name, device_id, ports, mappings)
|
||||
|
||||
def name(self):
|
||||
"""
|
||||
@@ -518,7 +333,7 @@ class ATMSwitch(Node):
|
||||
|
||||
def configPage(self):
|
||||
"""
|
||||
Returns the configuration page widget to be used by the node configurator.
|
||||
Returns the configuration page widget to be used by the node properties dialog.
|
||||
|
||||
:returns: QWidget object
|
||||
"""
|
||||
@@ -534,17 +349,7 @@ class ATMSwitch(Node):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/atm_switch.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when this node is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/atm_switch.selected.svg"
|
||||
return ":/symbols/atm_switch.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
@@ -23,34 +23,33 @@ from .router import Router
|
||||
|
||||
|
||||
class C1700(Router):
|
||||
|
||||
"""
|
||||
Dynamips c1700 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server, chassis="1720"):
|
||||
Router.__init__(self, module, server, platform="c1700")
|
||||
def __init__(self, module, server, project, chassis="1720"):
|
||||
|
||||
self._platform_settings = {"ram": 64,
|
||||
"nvram": 32,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": "1720",
|
||||
"iomem": 15,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "C1700-MB-1FE"}
|
||||
super().__init__(module, server, project, platform="c1700")
|
||||
c1700_settings = {"ram": 128,
|
||||
"nvram": 32,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": "1720",
|
||||
"iomem": 15,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "C1700-MB-1FE"}
|
||||
|
||||
# set the default adapter for slot 1 for these chassis
|
||||
if chassis in ['1751', '1760']:
|
||||
self._platform_settings["slot1"] = "C1700-MB-WIC1"
|
||||
c1700_settings["slot1"] = "C1700-MB-WIC1"
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c1700_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,11 +23,13 @@ from .router import Router
|
||||
|
||||
|
||||
class C2600(Router):
|
||||
|
||||
"""
|
||||
Dynamips c2600 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
# get the default slot0 adapter based on the chassis
|
||||
@@ -42,25 +44,22 @@ class C2600(Router):
|
||||
"2650XM": "C2600-MB-1FE",
|
||||
"2651XM": "C2600-MB-2FE"}
|
||||
|
||||
def __init__(self, module, server, chassis="2610"):
|
||||
Router.__init__(self, module, server, platform="c2600")
|
||||
def __init__(self, module, server, project, chassis="2610"):
|
||||
|
||||
self._platform_settings = {"ram": 64,
|
||||
"nvram": 128,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": chassis,
|
||||
"iomem": 15,
|
||||
"clock_divisor": 8}
|
||||
super().__init__(module, server, project, platform="c2600")
|
||||
c2600_settings = {"ram": 128,
|
||||
"nvram": 128,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": chassis,
|
||||
"iomem": 15,
|
||||
"clock_divisor": 8}
|
||||
|
||||
# set the default adapter for slot 0
|
||||
self._platform_settings["slot0"] = self.chassis_to_default_adapter[chassis]
|
||||
c2600_settings["slot0"] = self.chassis_to_default_adapter[chassis]
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c2600_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,29 +23,28 @@ from .router import Router
|
||||
|
||||
|
||||
class C2691(Router):
|
||||
|
||||
"""
|
||||
Dynamips c2691 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Router.__init__(self, module, server, platform="c2691")
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
self._platform_settings = {"ram": 128,
|
||||
"nvram": 112,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
super().__init__(module, server, project, platform="c2691")
|
||||
c2691_settings = {"ram": 192,
|
||||
"nvram": 112,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c2691_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,33 +23,32 @@ from .router import Router
|
||||
|
||||
|
||||
class C3600(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3600 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server, chassis="3640"):
|
||||
Router.__init__(self, module, server, platform="c3600")
|
||||
def __init__(self, module, server, project, chassis="3640"):
|
||||
|
||||
self._platform_settings = {"ram": 128,
|
||||
"nvram": 128,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": chassis,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 4}
|
||||
super().__init__(module, server, project, platform="c3600")
|
||||
c3600_settings = {"ram": 192,
|
||||
"nvram": 128,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"chassis": chassis,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 4}
|
||||
|
||||
# chassis 3660 has a default adapter
|
||||
if chassis == "3660":
|
||||
self._platform_settings["slot0"] = "Leopard-2FE"
|
||||
c3600_settings["slot0"] = "Leopard-2FE"
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c3600_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,29 +23,28 @@ from .router import Router
|
||||
|
||||
|
||||
class C3725(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3725 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Router.__init__(self, module, server, platform="c3725")
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
self._platform_settings = {"ram": 128,
|
||||
"nvram": 112,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
super().__init__(module, server, project, platform="c3725")
|
||||
c3725_settings = {"ram": 128,
|
||||
"nvram": 112,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c3725_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,29 +23,28 @@ from .router import Router
|
||||
|
||||
|
||||
class C3745(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3745 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Router.__init__(self, module, server, platform="c3745")
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
self._platform_settings = {"ram": 128,
|
||||
"nvram": 304,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
super().__init__(module, server, project, platform="c3745")
|
||||
c3745_settings = {"ram": 256,
|
||||
"nvram": 304,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c3745_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
@@ -23,37 +23,36 @@ from .router import Router
|
||||
|
||||
|
||||
class C7200(Router):
|
||||
|
||||
"""
|
||||
Dynamips c7200 router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server, npe="npe-400"):
|
||||
Router.__init__(self, module, server, platform="c7200")
|
||||
def __init__(self, module, server, project, npe="npe-400"):
|
||||
|
||||
self._platform_settings = {"ram": 256,
|
||||
"nvram": 128,
|
||||
"disk0": 64,
|
||||
"disk1": 0,
|
||||
"npe": npe,
|
||||
"midplane": "vxr",
|
||||
"clock_divisor": 4,
|
||||
"sensors": [22, 22, 22, 22],
|
||||
"power_supplies": [1, 1]}
|
||||
super().__init__(module, server, project, platform="c7200")
|
||||
c7200_settings = {"ram": 512,
|
||||
"nvram": 128,
|
||||
"disk0": 64,
|
||||
"disk1": 0,
|
||||
"npe": npe,
|
||||
"midplane": "vxr",
|
||||
"clock_divisor": 4,
|
||||
"sensors": [22, 22, 22, 22],
|
||||
"power_supplies": [1, 1]}
|
||||
|
||||
# first slot is a mandatory Input/Output controller (based on NPE type)
|
||||
if npe == "npe-g2":
|
||||
self._platform_settings["slot0"] = "C7200-IO-GE-E"
|
||||
c7200_settings["slot0"] = "C7200-IO-GE-E"
|
||||
else:
|
||||
self._platform_settings["slot0"] = "C7200-IO-2FE"
|
||||
c7200_settings["slot0"] = "C7200-IO-FE"
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
self._settings.update(c7200_settings)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
|
||||
203
gns3/modules/dynamips/nodes/device.py
Normal file
203
gns3/modules/dynamips/nodes/device.py
Normal file
@@ -0,0 +1,203 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2014 GNS3 Technologies Inc.
|
||||
#
|
||||
# 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Base class for Device classes.
|
||||
"""
|
||||
|
||||
|
||||
from gns3.node import Node
|
||||
from gns3.packet_capture import PacketCapture
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Device(Node):
|
||||
|
||||
URL_PREFIX = "dynamips"
|
||||
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
super().__init__(module, server, project)
|
||||
self._device_id = None
|
||||
|
||||
def device_id(self):
|
||||
"""
|
||||
Return the ID of this device
|
||||
|
||||
:returns: identifier (string)
|
||||
"""
|
||||
|
||||
return self._device_id
|
||||
|
||||
def _setupCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while setting up {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
return
|
||||
|
||||
self._device_id = result["device_id"]
|
||||
self._settings["name"] = result["name"]
|
||||
log.info("{} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
self.created_signal.emit(self.id())
|
||||
self._module.addNode(self)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this Device instance.
|
||||
"""
|
||||
|
||||
log.debug("{} is being deleted".format(self.name()))
|
||||
# first delete all the links attached to this node
|
||||
self.delete_links_signal.emit()
|
||||
if self._device_id and self._server.connected():
|
||||
self.httpDelete("/{prefix}/devices/{device_id}".format(prefix=self.URL_PREFIX, device_id=self._device_id),
|
||||
self._deleteCallback)
|
||||
else:
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _deleteCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for delete.
|
||||
|
||||
:param result: server response (dict)
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
log.info("{} has been deleted".format(self.name()))
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _addNIOCallback(self, result, error=False, context={}, **kwargs):
|
||||
"""
|
||||
Callback for addNIO.
|
||||
|
||||
:param result: server response (dict)
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while adding a NIO for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
self.nio_cancel_signal.emit(self.id())
|
||||
else:
|
||||
self.nio_signal.emit(self.id(), context["port_id"])
|
||||
|
||||
def deleteNIO(self, port):
|
||||
"""
|
||||
Deletes an NIO from the specified port on this Device instance
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
log.debug("{} is deleting an NIO".format(self.name()))
|
||||
self.httpDelete("/{prefix}/devices/{device_id}/ports/{port}/nio".format(prefix=self.URL_PREFIX,
|
||||
port=port.portNumber(),
|
||||
device_id=self._device_id),
|
||||
self._deleteNIOCallback)
|
||||
|
||||
def _deleteNIOCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for deleteNIO.
|
||||
|
||||
:param result: server response (dict)
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("Error while deleting NIO {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
return
|
||||
|
||||
log.debug("{} has deleted a NIO: {}".format(self.name(), result))
|
||||
|
||||
def startPacketCapture(self, port, capture_file_name, data_link_type):
|
||||
"""
|
||||
Starts a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
:param capture_file_name: PCAP capture file path
|
||||
:param data_link_type: PCAP data link type
|
||||
"""
|
||||
|
||||
params = {"capture_file_name": capture_file_name,
|
||||
"data_link_type": data_link_type}
|
||||
|
||||
log.debug("{} is starting a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/start_capture".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._startPacketCaptureCallback,
|
||||
context={"port": port},
|
||||
body=params)
|
||||
|
||||
def _startPacketCaptureCallback(self, result, error=False, context={}, **kwargs):
|
||||
"""
|
||||
Callback for starting a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while starting capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
PacketCapture.instance().startCapture(self, context["port"], result["pcap_file_path"])
|
||||
|
||||
def stopPacketCapture(self, port):
|
||||
"""
|
||||
Stops a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
log.debug("{} is stopping a packet capture on {}".format(self.name(), port.name()))
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/stop_capture".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._stopPacketCaptureCallback,
|
||||
context={"port": port})
|
||||
|
||||
def _stopPacketCaptureCallback(self, result, error=False, context={}, **kwargs):
|
||||
"""
|
||||
Callback for stopping a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while stopping capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
PacketCapture.instance().stopCapture(self, context["port"])
|
||||
@@ -22,36 +22,37 @@ Asynchronously sends JSON messages to the GNS3 server and receives responses wit
|
||||
|
||||
from gns3.node import Node
|
||||
from gns3.ports.ethernet_port import EthernetPort
|
||||
from .device import Device
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EthernetHub(Node):
|
||||
class EthernetHub(Device):
|
||||
|
||||
"""
|
||||
Dynamips Ethernet hub.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Node.__init__(self, server)
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
log.info("Ethernet hub is being created")
|
||||
super().__init__(module, server, project)
|
||||
self.setStatus(Node.started) # this is an always-on node
|
||||
self._ethhub_id = None
|
||||
self._module = module
|
||||
self._ports = []
|
||||
self._settings = {"name": "",
|
||||
"ports": []}
|
||||
|
||||
def setup(self, name=None, initial_ports=[]):
|
||||
def setup(self, name=None, device_id=None, initial_ports=[]):
|
||||
"""
|
||||
Setups this hub.
|
||||
|
||||
:param name: optional name for this hub
|
||||
:param initial_ports: ports to be automatically added when creating this hub
|
||||
:param device_id: device identifier on the server
|
||||
:param initial_ports: ports to automatically be added when creating this hub
|
||||
"""
|
||||
|
||||
# let's create a unique name if none has been chosen
|
||||
@@ -62,6 +63,7 @@ class EthernetHub(Node):
|
||||
self.error_signal.emit(self.id(), "could not allocate a name for this Ethernet hub")
|
||||
return
|
||||
|
||||
self._settings["name"] = name
|
||||
if not initial_ports:
|
||||
# default configuration if no initial ports
|
||||
for port_number in range(1, 9):
|
||||
@@ -69,7 +71,7 @@ class EthernetHub(Node):
|
||||
initial_ports.append({"name": str(port_number),
|
||||
"port_number": port_number})
|
||||
|
||||
# add initial ports
|
||||
# add the initial ports
|
||||
for initial_port in initial_ports:
|
||||
port = EthernetPort(initial_port["name"])
|
||||
port.setPortNumber(initial_port["port_number"])
|
||||
@@ -80,61 +82,11 @@ class EthernetHub(Node):
|
||||
self._ports.append(port)
|
||||
self._settings["ports"].append(port.portNumber())
|
||||
|
||||
params = {"name": name}
|
||||
self._server.send_message("dynamips.ethhub.create", params, self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while setting up {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
self._ethhub_id = result["id"]
|
||||
if not self._ethhub_id:
|
||||
self.error_signal.emit(self.id(), "returned ID from server is null")
|
||||
return
|
||||
|
||||
self._settings["name"] = result["name"]
|
||||
log.info("Ethernet hub {} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
self.created_signal.emit(self.id())
|
||||
self._module.addNode(self)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this Ethernet hub.
|
||||
"""
|
||||
|
||||
log.debug("Ethernet hub {} is being deleted".format(self.name()))
|
||||
# first delete all the links attached to this node
|
||||
self.delete_links_signal.emit()
|
||||
if self._ethhub_id:
|
||||
self._server.send_message("dynamips.ethhub.delete", {"id": self._ethhub_id}, self._deleteCallback)
|
||||
else:
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _deleteCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for delete.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
log.info("{} has been deleted".format(self.name()))
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
params = {"name": name,
|
||||
"device_type": "ethernet_hub"}
|
||||
if device_id:
|
||||
params["device_id"] = device_id
|
||||
self.httpPost("/dynamips/devices", self._setupCallback, body=params)
|
||||
|
||||
def update(self, new_settings):
|
||||
"""
|
||||
@@ -143,50 +95,50 @@ class EthernetHub(Node):
|
||||
:param new_settings: settings dictionary
|
||||
"""
|
||||
|
||||
ports_to_create = []
|
||||
ports = new_settings["ports"]
|
||||
|
||||
updated = False
|
||||
for port_number in ports:
|
||||
if port_number not in ports_to_create:
|
||||
ports_to_create.append(port_number)
|
||||
if "ports" in new_settings:
|
||||
ports_to_create = []
|
||||
ports = new_settings["ports"]
|
||||
for port_number in ports:
|
||||
if port_number not in ports_to_create:
|
||||
ports_to_create.append(str(port_number))
|
||||
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
self._ports.remove(port)
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
self._ports.remove(port)
|
||||
updated = True
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
elif port.name() in ports_to_create:
|
||||
ports_to_create.remove(port.name())
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = EthernetPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(EthernetPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
else:
|
||||
ports_to_create.remove(port.name())
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = EthernetPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(EthernetPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
self._settings["ports"] = new_settings["ports"].copy()
|
||||
|
||||
params = {}
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
if self.hasAllocatedName(new_settings["name"]):
|
||||
self.error_signal.emit(self.id(), 'Name "{}" is already used by another node'.format(new_settings["name"]))
|
||||
return
|
||||
params = {"id": self._ethhub_id,
|
||||
"name": new_settings["name"]}
|
||||
params["name"] = new_settings["name"]
|
||||
updated = True
|
||||
|
||||
self._settings["ports"] = new_settings["ports"].copy()
|
||||
if updated:
|
||||
if params:
|
||||
log.debug("{} is being updated: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.ethhub.update", params, self._updateCallback)
|
||||
self.httpPut("/dynamips/devices/{device_id}".format(device_id=self._device_id), self._updateCallback, body=params)
|
||||
else:
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def _updateCallback(self, result, error=False):
|
||||
def _updateCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for update.
|
||||
|
||||
@@ -196,7 +148,7 @@ class EthernetHub(Node):
|
||||
|
||||
if error:
|
||||
log.error("error while updating {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
if "name" in result:
|
||||
self._settings["name"] = result["name"]
|
||||
@@ -204,164 +156,24 @@ class EthernetHub(Node):
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def allocateUDPPort(self, port_id):
|
||||
"""
|
||||
Requests an UDP port allocation.
|
||||
|
||||
:param port_id: port identifier
|
||||
"""
|
||||
|
||||
log.debug("{} is requesting an UDP port allocation".format(self.name()))
|
||||
self._server.send_message("dynamips.ethhub.allocate_udp_port", {"id": self._ethhub_id, "port_id": port_id}, self._allocateUDPPortCallback)
|
||||
|
||||
def _allocateUDPPortCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for allocateUDPPort.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
port_id = result["port_id"]
|
||||
lport = result["lport"]
|
||||
log.debug("{} has allocated UDP port {}".format(self.name(), port_id, lport))
|
||||
self.allocate_udp_nio_signal.emit(self.id(), port_id, lport)
|
||||
|
||||
def addNIO(self, port, nio):
|
||||
"""
|
||||
Adds a new NIO on the specified port for this hub.
|
||||
Adds a new NIO on the specified port for this Ethernet hub.
|
||||
|
||||
:param port: Port instance
|
||||
:param nio: NIO instance
|
||||
"""
|
||||
|
||||
params = {"id": self._ethhub_id,
|
||||
"port": port.portNumber(),
|
||||
"port_id": port.id()}
|
||||
|
||||
params = {}
|
||||
params["nio"] = self.getNIOInfo(nio)
|
||||
log.debug("{} is adding an {}: {}".format(self.name(), nio, params))
|
||||
self._server.send_message("dynamips.ethhub.add_nio", params, self._addNIOCallback)
|
||||
|
||||
def _addNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for addNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.nio_cancel_signal.emit(self.id())
|
||||
else:
|
||||
self.nio_signal.emit(self.id(), result["port_id"])
|
||||
|
||||
def deleteNIO(self, port):
|
||||
"""
|
||||
Deletes an NIO from the specified port on this hub.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._ethhub_id,
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is deleting an NIO: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.ethhub.delete_nio", params, self._deleteNIOCallback)
|
||||
|
||||
def _deleteNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for deleteNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting NIO {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
log.debug("{} has deleted a NIO: {}".format(self.name(), result))
|
||||
|
||||
def startPacketCapture(self, port, capture_file_name, data_link_type):
|
||||
"""
|
||||
Starts a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
:param capture_file_name: PCAP capture file path
|
||||
:param data_link_type: PCAP data link type
|
||||
"""
|
||||
|
||||
params = {"id": self._ethhub_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber(),
|
||||
"capture_file_name": capture_file_name,
|
||||
"data_link_type": data_link_type}
|
||||
|
||||
log.debug("{} is starting a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.ethhub.start_capture", params, self._startPacketCaptureCallback)
|
||||
|
||||
def _startPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for starting a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while starting capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully started capturing packets on {}".format(self.name(), port.name()))
|
||||
try:
|
||||
port.startPacketCapture(result["capture_file_path"])
|
||||
except OSError as e:
|
||||
self.error_signal.emit(self.id(), "could not start the packet capture reader: {}: {}".format(e, e.filename))
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
|
||||
def stopPacketCapture(self, port):
|
||||
"""
|
||||
Stops a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._ethhub_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is stopping a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.ethhub.stop_capture", params, self._stopPacketCaptureCallback)
|
||||
|
||||
def _stopPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for stopping a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while stopping capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully stopped capturing packets on {}".format(self.name(), port.name()))
|
||||
port.stopPacketCapture()
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/nio".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._addNIOCallback,
|
||||
context={"port_id": port.id()},
|
||||
body=params)
|
||||
|
||||
def info(self):
|
||||
"""
|
||||
@@ -371,14 +183,15 @@ class EthernetHub(Node):
|
||||
"""
|
||||
|
||||
info = """Ethernet hub {name} is always-on
|
||||
Node ID is {id}, server's Ethernet hub ID is {ethhub_id}
|
||||
Local node ID is {id}
|
||||
Server's Device ID is {device_id}
|
||||
Hardware is Dynamips emulated simple Ethernet hub
|
||||
Hub's server runs on {host}:{port}
|
||||
""".format(name=self.name(),
|
||||
id=self.id(),
|
||||
ethhub_id=self._ethhub_id,
|
||||
host=self._server.host,
|
||||
port=self._server.port)
|
||||
device_id=self._device_id,
|
||||
host=self._server.host(),
|
||||
port=self._server.port())
|
||||
|
||||
port_info = ""
|
||||
for port in self._ports:
|
||||
@@ -399,11 +212,11 @@ class EthernetHub(Node):
|
||||
"""
|
||||
|
||||
hub = {"id": self.id(),
|
||||
"device_id": self._device_id,
|
||||
"type": self.__class__.__name__,
|
||||
"description": str(self),
|
||||
"properties": {"name": self.name()},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
"server_id": self._server.id()}
|
||||
|
||||
# add the ports
|
||||
if self._ports:
|
||||
@@ -424,6 +237,10 @@ class EthernetHub(Node):
|
||||
settings = node_info["properties"]
|
||||
name = settings.pop("name")
|
||||
|
||||
# pre-1.3 projects have no device id, set to 1 to have
|
||||
# a proper project conversion on the server side
|
||||
device_id = node_info.get("device_id", 1)
|
||||
|
||||
# create the ports with the correct port numbers and IDs
|
||||
ports = []
|
||||
if "ports" in node_info:
|
||||
@@ -431,7 +248,7 @@ class EthernetHub(Node):
|
||||
|
||||
log.info("Ethernet hub {} is loading".format(name))
|
||||
self.setName(name)
|
||||
self.setup(name, ports)
|
||||
self.setup(name, device_id, ports)
|
||||
|
||||
def name(self):
|
||||
"""
|
||||
@@ -462,7 +279,7 @@ class EthernetHub(Node):
|
||||
|
||||
def configPage(self):
|
||||
"""
|
||||
Returns the configuration page widget to be used by the node configurator.
|
||||
Returns the configuration page widget to be used by the node properties dialog.
|
||||
|
||||
:returns: QWidget object
|
||||
"""
|
||||
@@ -478,17 +295,7 @@ class EthernetHub(Node):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/hub.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when this node is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/hub.selected.svg"
|
||||
return ":/symbols/hub.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
@@ -22,35 +22,36 @@ Asynchronously sends JSON messages to the GNS3 server and receives responses wit
|
||||
|
||||
from gns3.node import Node
|
||||
from gns3.ports.ethernet_port import EthernetPort
|
||||
from .device import Device
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EthernetSwitch(Node):
|
||||
class EthernetSwitch(Device):
|
||||
|
||||
"""
|
||||
Dynamips Ethernet switch.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Node.__init__(self, server)
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
log.info("Ethernet switch is being created")
|
||||
super().__init__(module, server, project)
|
||||
self.setStatus(Node.started) # this is an always-on node
|
||||
self._ethsw_id = None
|
||||
self._module = module
|
||||
self._ports = []
|
||||
self._settings = {"name": "",
|
||||
"ports": {}}
|
||||
|
||||
def setup(self, name=None, initial_ports=[]):
|
||||
def setup(self, name=None, device_id=None, initial_ports=[]):
|
||||
"""
|
||||
Setups this Ethernet switch.
|
||||
|
||||
:param name: optional name for this switch
|
||||
:param device_id: device identifier on the server
|
||||
:param initial_ports: ports to be automatically added when creating this switch
|
||||
"""
|
||||
|
||||
@@ -62,6 +63,7 @@ class EthernetSwitch(Node):
|
||||
self.error_signal.emit(self.id(), "could not allocate a name for this Ethernet switch")
|
||||
return
|
||||
|
||||
self._settings["name"] = name
|
||||
if not initial_ports:
|
||||
# default configuration if no initial ports
|
||||
for port_number in range(1, 9):
|
||||
@@ -83,61 +85,11 @@ class EthernetSwitch(Node):
|
||||
self._settings["ports"][port.portNumber()] = {"type": initial_port["type"],
|
||||
"vlan": initial_port["vlan"]}
|
||||
|
||||
params = {"name": name}
|
||||
self._server.send_message("dynamips.ethsw.create", params, self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while setting up {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
self._ethsw_id = result["id"]
|
||||
if not self._ethsw_id:
|
||||
self.error_signal.emit(self.id(), "returned ID from server is null")
|
||||
return
|
||||
|
||||
self._settings["name"] = result["name"]
|
||||
log.info("Ethernet switch {} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
self.created_signal.emit(self.id())
|
||||
self._module.addNode(self)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this Ethernet switch.
|
||||
"""
|
||||
|
||||
log.debug("Ethernet switch {} is being deleted".format(self.name()))
|
||||
# first delete all the links attached to this node
|
||||
self.delete_links_signal.emit()
|
||||
if self._ethsw_id:
|
||||
self._server.send_message("dynamips.ethsw.delete", {"id": self._ethsw_id}, self._deleteCallback)
|
||||
else:
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _deleteCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for delete.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
log.info("Ethernet switch {} has been deleted".format(self.name()))
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
params = {"name": name,
|
||||
"device_type": "ethernet_switch"}
|
||||
if device_id:
|
||||
params["device_id"] = device_id
|
||||
self.httpPost("/dynamips/devices", self._setupCallback, body=params)
|
||||
|
||||
def update(self, new_settings):
|
||||
"""
|
||||
@@ -146,31 +98,45 @@ class EthernetSwitch(Node):
|
||||
:param new_settings: settings dictionary
|
||||
"""
|
||||
|
||||
ports_to_update = {}
|
||||
ports = new_settings["ports"]
|
||||
updated = False
|
||||
for port_number in ports.keys():
|
||||
if port_number in self._settings["ports"]:
|
||||
if self._settings["ports"][port_number] != ports[port_number]:
|
||||
for port in self._ports:
|
||||
if port.portNumber() == port_number and not port.isFree():
|
||||
ports_to_update[port_number] = ports[port_number]
|
||||
break
|
||||
continue
|
||||
port = EthernetPort(str(port_number))
|
||||
port.setPortNumber(port_number)
|
||||
port.setStatus(EthernetPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(port_number))
|
||||
params = {}
|
||||
if "ports" in new_settings:
|
||||
ports_to_update = {}
|
||||
ports = new_settings["ports"]
|
||||
|
||||
params = {"id": self._ethsw_id}
|
||||
if ports_to_update:
|
||||
params["ports"] = {}
|
||||
for port_number, info in ports_to_update.items():
|
||||
params["ports"][port_number] = info
|
||||
updated = True
|
||||
for port_number in ports.keys():
|
||||
if port_number in self._settings["ports"]:
|
||||
if self._settings["ports"][port_number] != ports[port_number]:
|
||||
for port in self._ports:
|
||||
if port.portNumber() == port_number and not port.isFree():
|
||||
ports_to_update[port_number] = ports[port_number]
|
||||
break
|
||||
continue
|
||||
port = EthernetPort(str(port_number))
|
||||
port.setPortNumber(port_number)
|
||||
port.setStatus(EthernetPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(port_number))
|
||||
|
||||
if ports_to_update:
|
||||
params["ports"] = []
|
||||
for port_number, info in ports_to_update.items():
|
||||
info["port"] = port_number
|
||||
params["ports"].append(info)
|
||||
updated = True
|
||||
|
||||
# delete ports that are not configured
|
||||
for port_number in self._settings["ports"].keys():
|
||||
if port_number not in new_settings["ports"]:
|
||||
for port in self._ports.copy():
|
||||
if port.portNumber() == port_number:
|
||||
self._ports.remove(port)
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
break
|
||||
|
||||
self._settings["ports"] = new_settings["ports"].copy()
|
||||
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
if self.hasAllocatedName(new_settings["name"]):
|
||||
@@ -179,21 +145,14 @@ class EthernetSwitch(Node):
|
||||
params["name"] = new_settings["name"]
|
||||
updated = True
|
||||
|
||||
# delete ports that are not configured
|
||||
for port_number in self._settings["ports"].keys():
|
||||
if port_number not in new_settings["ports"]:
|
||||
for port in self._ports.copy():
|
||||
if port.portNumber() == port_number:
|
||||
self._ports.remove(port)
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
break
|
||||
|
||||
self._settings["ports"] = new_settings["ports"].copy()
|
||||
if updated:
|
||||
log.debug("{} is being updated: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.ethsw.update", params, self._updateCallback)
|
||||
self.httpPut("/dynamips/devices/{device_id}".format(device_id=self._device_id), self._updateCallback, body=params)
|
||||
else:
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def _updateCallback(self, result, error=False):
|
||||
def _updateCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for update.
|
||||
|
||||
@@ -203,7 +162,7 @@ class EthernetSwitch(Node):
|
||||
|
||||
if error:
|
||||
log.error("error while updating {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
if "name" in result:
|
||||
self._settings["name"] = result["name"]
|
||||
@@ -211,33 +170,6 @@ class EthernetSwitch(Node):
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def allocateUDPPort(self, port_id):
|
||||
"""
|
||||
Requests an UDP port allocation.
|
||||
|
||||
:param port_id: port identifier
|
||||
"""
|
||||
|
||||
log.debug("{} is requesting an UDP port allocation".format(self.name()))
|
||||
self._server.send_message("dynamips.ethsw.allocate_udp_port", {"id": self._ethsw_id, "port_id": port_id}, self._allocateUDPPortCallback)
|
||||
|
||||
def _allocateUDPPortCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for allocateUDPPort.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
port_id = result["port_id"]
|
||||
lport = result["lport"]
|
||||
log.debug("{} has allocated UDP port {}".format(self.name(), lport))
|
||||
self.allocate_udp_nio_signal.emit(self.id(), port_id, lport)
|
||||
|
||||
def addNIO(self, port, nio):
|
||||
"""
|
||||
Adds a new NIO on the specified port for this switch.
|
||||
@@ -246,133 +178,20 @@ class EthernetSwitch(Node):
|
||||
:param nio: NIO instance
|
||||
"""
|
||||
|
||||
port_info = self._settings["ports"][port.portNumber()]
|
||||
params = {"id": self._ethsw_id,
|
||||
"port": port.portNumber(),
|
||||
"port_id": port.id(),
|
||||
"vlan": port_info["vlan"],
|
||||
"port_type": port_info["type"]}
|
||||
|
||||
params = {}
|
||||
params["nio"] = self.getNIOInfo(nio)
|
||||
port_info = self._settings["ports"][port.portNumber()]
|
||||
port_settings = {"vlan": port_info["vlan"],
|
||||
"type": port_info["type"]}
|
||||
params["port_settings"] = port_settings
|
||||
log.debug("{} is adding an {}: {}".format(self.name(), nio, params))
|
||||
self._server.send_message("dynamips.ethsw.add_nio", params, self._addNIOCallback)
|
||||
|
||||
def _addNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for addNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.nio_cancel_signal.emit(self.id())
|
||||
else:
|
||||
log.debug("{} has added a new NIO: {}".format(self.name(), result))
|
||||
self.nio_signal.emit(self.id(), result["port_id"])
|
||||
|
||||
def deleteNIO(self, port):
|
||||
"""
|
||||
Deletes an NIO from the specified port on this switch.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._ethsw_id,
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is deleting an NIO: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.ethsw.delete_nio", params, self._deleteNIOCallback)
|
||||
|
||||
def _deleteNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for deleteNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting NIO {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
log.debug("{} has deleted a NIO: {}".format(self.name(), result))
|
||||
|
||||
def startPacketCapture(self, port, capture_file_name, data_link_type):
|
||||
"""
|
||||
Starts a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
:param capture_file_name: PCAP capture file path
|
||||
:param data_link_type: PCAP data link type
|
||||
"""
|
||||
|
||||
params = {"id": self._ethsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber(),
|
||||
"capture_file_name": capture_file_name,
|
||||
"data_link_type": data_link_type}
|
||||
|
||||
log.debug("{} is starting a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.ethsw.start_capture", params, self._startPacketCaptureCallback)
|
||||
|
||||
def _startPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for starting a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while starting capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully started capturing packets on {}".format(self.name(), port.name()))
|
||||
try:
|
||||
port.startPacketCapture(result["capture_file_path"])
|
||||
except OSError as e:
|
||||
self.error_signal.emit(self.id(), "could not start the packet capture reader: {}: {}".format(e, e.filename))
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
|
||||
def stopPacketCapture(self, port):
|
||||
"""
|
||||
Stops a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._ethsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is stopping a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.ethsw.stop_capture", params, self._stopPacketCaptureCallback)
|
||||
|
||||
def _stopPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for stopping a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while stopping capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully stopped capturing packets on {}".format(self.name(), port.name()))
|
||||
port.stopPacketCapture()
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/nio".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._addNIOCallback,
|
||||
context={"port_id": port.id()},
|
||||
body=params)
|
||||
|
||||
def info(self):
|
||||
"""
|
||||
@@ -382,14 +201,15 @@ class EthernetSwitch(Node):
|
||||
"""
|
||||
|
||||
info = """Ethernet switch {name} is always-on
|
||||
Node ID is {id}, server's Ethernet switch ID is {ethsw_id}
|
||||
Local node ID is {id}
|
||||
Server's Device ID is {device_id}
|
||||
Hardware is Dynamips emulated simple Ethernet switch
|
||||
Switch's server runs on {host}:{port}
|
||||
""".format(name=self.name(),
|
||||
id=self.id(),
|
||||
ethsw_id=self._ethsw_id,
|
||||
host=self._server.host,
|
||||
port=self._server.port)
|
||||
device_id=self._device_id,
|
||||
host=self._server.host(),
|
||||
port=self._server.port())
|
||||
|
||||
port_info = ""
|
||||
for port in self._ports:
|
||||
@@ -421,11 +241,11 @@ class EthernetSwitch(Node):
|
||||
"""
|
||||
|
||||
switch = {"id": self.id(),
|
||||
"device_id": self._device_id,
|
||||
"type": self.__class__.__name__,
|
||||
"description": str(self),
|
||||
"properties": {"name": self.name()},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
"server_id": self._server.id()}
|
||||
|
||||
# add the ports
|
||||
if self._ports:
|
||||
@@ -450,13 +270,17 @@ class EthernetSwitch(Node):
|
||||
settings = node_info["properties"]
|
||||
name = settings.pop("name")
|
||||
|
||||
# pre-1.3 projects have no device id, set to 1 to have
|
||||
# a proper project conversion on the server side
|
||||
device_id = node_info.get("device_id", 1)
|
||||
|
||||
ports = []
|
||||
if "ports" in node_info:
|
||||
ports = node_info["ports"]
|
||||
|
||||
log.info("Ethernet switch {} is loading".format(name))
|
||||
self.setName(name)
|
||||
self.setup(name, ports)
|
||||
self.setup(name, device_id, ports)
|
||||
|
||||
def name(self):
|
||||
"""
|
||||
@@ -487,7 +311,7 @@ class EthernetSwitch(Node):
|
||||
|
||||
def configPage(self):
|
||||
"""
|
||||
Returns the configuration page widget to be used by the node configurator.
|
||||
Returns the configuration page widget to be used by the node properties dialog.
|
||||
|
||||
:returns: QWidget object
|
||||
"""
|
||||
@@ -503,17 +327,7 @@ class EthernetSwitch(Node):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/ethernet_switch.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when this node is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/ethernet_switch.selected.svg"
|
||||
return ":/symbols/ethernet_switch.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
@@ -17,63 +17,36 @@
|
||||
|
||||
"""
|
||||
EtherSwitch router implementation (based on Dynamips c3745).
|
||||
This is legacy code, kept only to support topologies made with GNS3 < 1.2.2
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import pkg_resources
|
||||
from .router import Router
|
||||
from gns3.node import Node
|
||||
|
||||
|
||||
class EtherSwitchRouter(Router):
|
||||
|
||||
"""
|
||||
EtherSwitch router.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Router.__init__(self, module, server, platform="c3725")
|
||||
def __init__(self, module, server, project):
|
||||
super().__init__(module, server, project, platform="c3725")
|
||||
|
||||
self._platform_settings = {"ram": 128,
|
||||
"nvram": 304,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
self._etherswitch_settings = {"ram": 128,
|
||||
"nvram": 304,
|
||||
"disk0": 16,
|
||||
"disk1": 0,
|
||||
"iomem": 5,
|
||||
"clock_divisor": 8,
|
||||
"slot0": "GT96100-FE"}
|
||||
|
||||
# merge platform settings with the generic ones
|
||||
self._settings.update(self._platform_settings)
|
||||
|
||||
# save the default settings
|
||||
self._defaults = self._settings.copy()
|
||||
|
||||
def setup(self, image, ram, name=None, router_id=None, initial_settings={}):
|
||||
"""
|
||||
Setups this router.
|
||||
|
||||
:param image: IOS image path
|
||||
:param ram: amount of RAM
|
||||
:param name: optional name for this router
|
||||
:param initial_settings: other additional and not mandatory settings
|
||||
"""
|
||||
# let's create a unique name if none has been chosen
|
||||
if not name:
|
||||
name = self.allocateName("ESW")
|
||||
|
||||
resource_name = "configs/ios_etherswitch_startup-config.txt"
|
||||
if hasattr(sys, "frozen") and os.path.isfile(resource_name):
|
||||
startup_config = os.path.normpath(resource_name)
|
||||
elif pkg_resources.resource_exists("gns3", resource_name):
|
||||
ios_etherswitch_config_path = pkg_resources.resource_filename("gns3", resource_name)
|
||||
startup_config = os.path.normpath(ios_etherswitch_config_path)
|
||||
|
||||
initial_settings.update({"slot1": "NM-16ESW", # add the EtherSwitch module
|
||||
"startup_config": startup_config}) # add the EtherSwitch startup-config
|
||||
Router.setup(self, image, ram, name, router_id, initial_settings)
|
||||
self._settings.update(self._etherswitch_settings)
|
||||
|
||||
@staticmethod
|
||||
def defaultSymbol():
|
||||
@@ -83,17 +56,7 @@ class EtherSwitchRouter(Router):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/multilayer_switch.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when this node is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/multilayer_switch.selected.svg"
|
||||
return ":/symbols/multilayer_switch.svg"
|
||||
|
||||
@staticmethod
|
||||
def categories():
|
||||
|
||||
@@ -22,35 +22,36 @@ Asynchronously sends JSON messages to the GNS3 server and receives responses wit
|
||||
|
||||
from gns3.node import Node
|
||||
from gns3.ports.frame_relay_port import FrameRelayPort
|
||||
from .device import Device
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FrameRelaySwitch(Node):
|
||||
class FrameRelaySwitch(Device):
|
||||
|
||||
"""
|
||||
Dynamips Frame-Relay switch.
|
||||
|
||||
:param module: parent module for this node
|
||||
:param server: GNS3 server instance
|
||||
:param project: Project instance
|
||||
"""
|
||||
|
||||
def __init__(self, module, server):
|
||||
Node.__init__(self, server)
|
||||
def __init__(self, module, server, project):
|
||||
|
||||
log.info("Frame-Relay switch is being created")
|
||||
super().__init__(module, server, project)
|
||||
self.setStatus(Node.started) # this is an always-on node
|
||||
self._frsw_id = None
|
||||
self._ports = []
|
||||
self._module = module
|
||||
self._settings = {"name": "",
|
||||
"mappings": {}}
|
||||
|
||||
def setup(self, name=None, initial_ports=[], initial_mappings={}):
|
||||
def setup(self, name=None, device_id=None, initial_ports=[], initial_mappings={}):
|
||||
"""
|
||||
Setups this Frame Relay switch.
|
||||
|
||||
:param name: name for this switch.
|
||||
:param device_id: device identifier on the server
|
||||
:param initial_ports: ports to be automatically added when creating this Frame relay switch
|
||||
:param initial_mappings: mappings to be automatically added when creating this Frame relay switch
|
||||
"""
|
||||
@@ -63,6 +64,7 @@ class FrameRelaySwitch(Node):
|
||||
self.error_signal.emit(self.id(), "could not allocate a name for this Frame Relay switch")
|
||||
return
|
||||
|
||||
self._settings["name"] = name
|
||||
if initial_mappings:
|
||||
# add initial mappings
|
||||
self._settings["mappings"] = initial_mappings.copy()
|
||||
@@ -77,61 +79,11 @@ class FrameRelaySwitch(Node):
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
|
||||
params = {"name": name}
|
||||
self._server.send_message("dynamips.frsw.create", params, self._setupCallback)
|
||||
|
||||
def _setupCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for setup.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while setting up {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
self._frsw_id = result["id"]
|
||||
if not self._frsw_id:
|
||||
self.error_signal.emit(self.id(), "returned ID from server is null")
|
||||
return
|
||||
|
||||
self._settings["name"] = result["name"]
|
||||
log.info("Frame Relay switch {} has been created".format(self.name()))
|
||||
self.setInitialized(True)
|
||||
self.created_signal.emit(self.id())
|
||||
self._module.addNode(self)
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this Frame Relay switch.
|
||||
"""
|
||||
|
||||
log.debug("Frame Relay switch {} is being deleted".format(self.name()))
|
||||
# first delete all the links attached to this node
|
||||
self.delete_links_signal.emit()
|
||||
if self._frsw_id:
|
||||
self._server.send_message("dynamips.frsw.delete", {"id": self._frsw_id}, self._deleteCallback)
|
||||
else:
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
|
||||
def _deleteCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for the delete method.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
log.info("{} has been deleted".format(self.name()))
|
||||
self.deleted_signal.emit()
|
||||
self._module.removeNode(self)
|
||||
params = {"name": name,
|
||||
"device_type": "frame_relay_switch"}
|
||||
if device_id:
|
||||
params["device_id"] = device_id
|
||||
self.httpPost("/dynamips/devices", self._setupCallback, body=params)
|
||||
|
||||
def update(self, new_settings):
|
||||
"""
|
||||
@@ -140,54 +92,55 @@ class FrameRelaySwitch(Node):
|
||||
:param new_settings: settings dictionary
|
||||
"""
|
||||
|
||||
ports_to_create = []
|
||||
mapping = new_settings["mappings"]
|
||||
|
||||
updated = False
|
||||
for source, destination in mapping.items():
|
||||
source_port = source.split(":")[0]
|
||||
destination_port = destination.split(":")[0]
|
||||
if source_port not in ports_to_create:
|
||||
ports_to_create.append(source_port)
|
||||
if destination_port not in ports_to_create:
|
||||
ports_to_create.append(destination_port)
|
||||
if "mappings" in new_settings:
|
||||
ports_to_create = []
|
||||
mapping = new_settings["mappings"]
|
||||
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
self._ports.remove(port)
|
||||
for source, destination in mapping.items():
|
||||
source_port = source.split(":")[0]
|
||||
destination_port = destination.split(":")[0]
|
||||
if source_port not in ports_to_create:
|
||||
ports_to_create.append(source_port)
|
||||
if destination_port not in ports_to_create:
|
||||
ports_to_create.append(destination_port)
|
||||
|
||||
for port in self._ports.copy():
|
||||
if port.isFree():
|
||||
self._ports.remove(port)
|
||||
updated = True
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
else:
|
||||
ports_to_create.remove(port.name())
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = FrameRelayPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(FrameRelayPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been removed".format(port.name()))
|
||||
else:
|
||||
ports_to_create.remove(port.name())
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
|
||||
for port_name in ports_to_create:
|
||||
port = FrameRelayPort(port_name)
|
||||
port.setPortNumber(int(port_name))
|
||||
port.setStatus(FrameRelayPort.started)
|
||||
port.setPacketCaptureSupported(True)
|
||||
self._ports.append(port)
|
||||
updated = True
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
self._settings["mappings"] = new_settings["mappings"].copy()
|
||||
|
||||
params = {}
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
if self.hasAllocatedName(new_settings["name"]):
|
||||
self.error_signal.emit(self.id(), 'Name "{}" is already used by another node'.format(new_settings["name"]))
|
||||
return
|
||||
params = {"id": self._frsw_id,
|
||||
"name": new_settings["name"]}
|
||||
params["name"] = new_settings["name"]
|
||||
updated = True
|
||||
|
||||
self._settings["mappings"] = new_settings["mappings"].copy()
|
||||
if updated:
|
||||
if params:
|
||||
log.debug("{} is being updated: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.frsw.update", params, self._updateCallback)
|
||||
self.httpPut("/dynamips/devices/{device_id}".format(device_id=self._device_id), self._updateCallback, body=params)
|
||||
else:
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def _updateCallback(self, result, error=False):
|
||||
def _updateCallback(self, result, error=False, **kwargs):
|
||||
"""
|
||||
Callback for update.
|
||||
|
||||
@@ -197,7 +150,7 @@ class FrameRelaySwitch(Node):
|
||||
|
||||
if error:
|
||||
log.error("error while updating {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.server_error_signal.emit(self.id(), result["message"])
|
||||
else:
|
||||
if "name" in result:
|
||||
self._settings["name"] = result["name"]
|
||||
@@ -205,31 +158,6 @@ class FrameRelaySwitch(Node):
|
||||
log.info("{} has been updated".format(self.name()))
|
||||
self.updated_signal.emit()
|
||||
|
||||
def allocateUDPPort(self, port_id):
|
||||
"""
|
||||
Requests an UDP port allocation.
|
||||
"""
|
||||
|
||||
log.debug("{} is requesting an UDP port allocation".format(self.name()))
|
||||
self._server.send_message("dynamips.frsw.allocate_udp_port", {"id": self._frsw_id, "port_id": port_id}, self._allocateUDPPortCallback)
|
||||
|
||||
def _allocateUDPPortCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for allocateUDPPort.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
port_id = result["port_id"]
|
||||
lport = result["lport"]
|
||||
log.debug("{} has allocated UDP port {}".format(self.name(), lport))
|
||||
self.allocate_udp_nio_signal.emit(self.id(), port_id, lport)
|
||||
|
||||
def addNIO(self, port, nio):
|
||||
"""
|
||||
Adds a new NIO on the specified port for this Frame Relay switch.
|
||||
@@ -238,11 +166,7 @@ class FrameRelaySwitch(Node):
|
||||
:param nio: NIO instance
|
||||
"""
|
||||
|
||||
params = {"id": self._frsw_id,
|
||||
"port": port.portNumber(),
|
||||
"port_id": port.id()}
|
||||
|
||||
params["nio"] = self.getNIOInfo(nio)
|
||||
params = {"nio": self.getNIOInfo(nio)}
|
||||
params["mappings"] = {}
|
||||
for source, destination in self._settings["mappings"].items():
|
||||
source_port = source.split(":")[0]
|
||||
@@ -254,124 +178,13 @@ class FrameRelaySwitch(Node):
|
||||
log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
|
||||
|
||||
log.debug("{} is adding an {}: {}".format(self.name(), nio, params))
|
||||
self._server.send_message("dynamips.frsw.add_nio", params, self._addNIOCallback)
|
||||
|
||||
def _addNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for addNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
self.nio_cancel_signal.emit(self.id())
|
||||
else:
|
||||
log.debug("{} has added a new NIO: {}".format(self.name(), result))
|
||||
self.nio_signal.emit(self.id(), result["port_id"])
|
||||
|
||||
def deleteNIO(self, port):
|
||||
"""
|
||||
Deletes an NIO from the specified port on this switch.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._frsw_id,
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is deleting an NIO: {}".format(self.name(), params))
|
||||
self._server.send_message("dynamips.frsw.delete_nio", params, self._deleteNIOCallback)
|
||||
|
||||
def _deleteNIOCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for deleteNIO.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while deleting NIO {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
return
|
||||
|
||||
log.debug("{} has deleted a NIO: {}".format(self.name(), result))
|
||||
|
||||
def startPacketCapture(self, port, capture_file_name, data_link_type):
|
||||
"""
|
||||
Starts a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
:param capture_file_name: PCAP capture file path
|
||||
:param data_link_type: PCAP data link type
|
||||
"""
|
||||
|
||||
params = {"id": self._frsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber(),
|
||||
"capture_file_name": capture_file_name,
|
||||
"data_link_type": data_link_type}
|
||||
|
||||
log.debug("{} is starting a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.frsw.start_capture", params, self._startPacketCaptureCallback)
|
||||
|
||||
def _startPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for starting a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while starting capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully started capturing packets on {}".format(self.name(), port.name()))
|
||||
try:
|
||||
port.startPacketCapture(result["capture_file_path"])
|
||||
except OSError as e:
|
||||
self.error_signal.emit(self.id(), "could not start the packet capture reader: {}: {}".format(e, e.filename))
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
|
||||
def stopPacketCapture(self, port):
|
||||
"""
|
||||
Stops a packet capture.
|
||||
|
||||
:param port: Port instance
|
||||
"""
|
||||
|
||||
params = {"id": self._frsw_id,
|
||||
"port_id": port.id(),
|
||||
"port": port.portNumber()}
|
||||
|
||||
log.debug("{} is stopping a packet capture on {}: {}".format(self.name(), port.name(), params))
|
||||
self._server.send_message("dynamips.frsw.stop_capture", params, self._stopPacketCaptureCallback)
|
||||
|
||||
def _stopPacketCaptureCallback(self, result, error=False):
|
||||
"""
|
||||
Callback for stopping a packet capture.
|
||||
|
||||
:param result: server response
|
||||
:param error: indicates an error (boolean)
|
||||
"""
|
||||
|
||||
if error:
|
||||
log.error("error while stopping capture {}: {}".format(self.name(), result["message"]))
|
||||
self.server_error_signal.emit(self.id(), result["code"], result["message"])
|
||||
else:
|
||||
for port in self._ports:
|
||||
if port.id() == result["port_id"]:
|
||||
log.info("{} has successfully stopped capturing packets on {}".format(self.name(), port.name()))
|
||||
port.stopPacketCapture()
|
||||
self.updated_signal.emit()
|
||||
break
|
||||
self.httpPost("/{prefix}/devices/{device_id}/ports/{port}/nio".format(
|
||||
port=port.portNumber(),
|
||||
prefix=self.URL_PREFIX,
|
||||
device_id=self._device_id),
|
||||
self._addNIOCallback,
|
||||
context={"port_id": port.id()},
|
||||
body=params)
|
||||
|
||||
def info(self):
|
||||
"""
|
||||
@@ -381,14 +194,15 @@ class FrameRelaySwitch(Node):
|
||||
"""
|
||||
|
||||
info = """Frame relay switch {name} is always-on
|
||||
Node ID is {id}, server's frame relay switch ID is {frsw_id}
|
||||
Local node ID is {id}
|
||||
Server's Device ID is {device_id}
|
||||
Hardware is Dynamips emulated simple Frame relay switch
|
||||
Switch's server runs on {host}:{port}
|
||||
""".format(name=self.name(),
|
||||
id=self.id(),
|
||||
frsw_id=self._frsw_id,
|
||||
host=self._server.host,
|
||||
port=self._server.port)
|
||||
device_id=self._device_id,
|
||||
host=self._server.host(),
|
||||
port=self._server.port())
|
||||
|
||||
port_info = ""
|
||||
for port in self._ports:
|
||||
@@ -396,7 +210,7 @@ class FrameRelaySwitch(Node):
|
||||
port_info += " Port {} is empty\n".format(port.name())
|
||||
else:
|
||||
port_info += " Port {name} {description}\n".format(name=port.name(),
|
||||
description=port.description())
|
||||
description=port.description())
|
||||
|
||||
for source, destination in self._settings["mappings"].items():
|
||||
source_port, source_dlci = source.split(":")
|
||||
@@ -427,6 +241,7 @@ class FrameRelaySwitch(Node):
|
||||
"""
|
||||
|
||||
frsw = {"id": self.id(),
|
||||
"device_id": self._device_id,
|
||||
"type": self.__class__.__name__,
|
||||
"description": str(self),
|
||||
"properties": {"name": self.name()},
|
||||
@@ -455,6 +270,10 @@ class FrameRelaySwitch(Node):
|
||||
settings = node_info["properties"]
|
||||
name = settings.pop("name")
|
||||
|
||||
# pre-1.3 projects have no device id, set to 1 to have
|
||||
# a proper project conversion on the server side
|
||||
device_id = node_info.get("device_id", 1)
|
||||
|
||||
mappings = {}
|
||||
if "mappings" in settings:
|
||||
mappings = settings["mappings"]
|
||||
@@ -465,7 +284,7 @@ class FrameRelaySwitch(Node):
|
||||
|
||||
log.info("Frame-Relay switch {} is loading".format(name))
|
||||
self.setName(name)
|
||||
self.setup(name, ports, mappings)
|
||||
self.setup(name, device_id, ports, mappings)
|
||||
|
||||
def name(self):
|
||||
"""
|
||||
@@ -496,7 +315,7 @@ class FrameRelaySwitch(Node):
|
||||
|
||||
def configPage(self):
|
||||
"""
|
||||
Returns the configuration page widget to be used by the node configurator.
|
||||
Returns the configuration page widget to be used by the node properties dialog.
|
||||
|
||||
:returns: QWidget object
|
||||
"""
|
||||
@@ -512,17 +331,7 @@ class FrameRelaySwitch(Node):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/frame_relay_switch.normal.svg"
|
||||
|
||||
@staticmethod
|
||||
def hoverSymbol():
|
||||
"""
|
||||
Returns the symbol to use when this node is hovered.
|
||||
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/frame_relay_switch.selected.svg"
|
||||
return ":/symbols/frame_relay_switch.svg"
|
||||
|
||||
@staticmethod
|
||||
def symbolName():
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,18 +20,19 @@ Configuration page for Dynamips ATM bridges.
|
||||
"""
|
||||
|
||||
import re
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.atm_bridge_configuration_page_ui import Ui_atmBridgeConfigPageWidget
|
||||
|
||||
|
||||
class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
class ATMBridgeConfigurationPage(QtWidgets.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for ATM bridges.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self._mapping = {}
|
||||
|
||||
@@ -74,7 +75,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
@@ -90,7 +91,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
atm_vci = self.uiATMVCISpinBox.value()
|
||||
|
||||
if ethernet_port == atm_port:
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
|
||||
return
|
||||
|
||||
destination = "{port}:{vpi}:{vci}".format(port=atm_port,
|
||||
@@ -98,10 +99,10 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
vci=atm_vci)
|
||||
|
||||
if destination in self._mapping:
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
return
|
||||
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, str(ethernet_port))
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -124,7 +125,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if (node_port.portNumber() == ethernet_port or node_port.portNumber() == atm_port) and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
return
|
||||
|
||||
del self.mapping[ethernet_port]
|
||||
@@ -149,7 +150,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
self._node = node
|
||||
|
||||
for ethernet_port, destination in settings["mappings"].items():
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, ethernet_port)
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -171,7 +172,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "ATM bridge name cannot be empty!")
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "ATM bridge name cannot be empty!")
|
||||
else:
|
||||
settings["name"] = name
|
||||
else:
|
||||
|
||||
@@ -20,18 +20,19 @@ Configuration page for Dynamips ATM switches.
|
||||
"""
|
||||
|
||||
import re
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.atm_switch_configuration_page_ui import Ui_atmSwitchConfigPageWidget
|
||||
|
||||
|
||||
class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
class ATMSwitchConfigurationPage(QtWidgets.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for ATM switches.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self._mapping = {}
|
||||
|
||||
@@ -85,7 +86,7 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
@@ -115,10 +116,10 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
destination = "{port}:{vpi}".format(port=destination_port, vpi=destination_vpi)
|
||||
|
||||
if source in self._mapping or destination in self._mapping:
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
return
|
||||
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, source)
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -144,7 +145,7 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if (node_port.portNumber() == source_port or node_port.portNumber() == destination_port) and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
return
|
||||
|
||||
del self._mapping[source]
|
||||
@@ -169,7 +170,7 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
self._node = node
|
||||
|
||||
for source, destination in settings["mappings"].items():
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, source)
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -191,7 +192,7 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "ATM switch name cannot be empty!")
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "ATM switch name cannot be empty!")
|
||||
else:
|
||||
settings["name"] = name
|
||||
else:
|
||||
|
||||
@@ -21,70 +21,64 @@ Configuration page for Dynamips preferences.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from gns3.qt import QtGui
|
||||
from gns3.servers import Servers
|
||||
import shutil
|
||||
from gns3.qt import QtWidgets
|
||||
from .. import Dynamips
|
||||
from ..ui.dynamips_preferences_page_ui import Ui_DynamipsPreferencesPageWidget
|
||||
from ..settings import DYNAMIPS_SETTINGS
|
||||
|
||||
|
||||
class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
class DynamipsPreferencesPage(QtWidgets.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for Dynamips.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
# connect signals
|
||||
self.uiDynamipsPathToolButton.clicked.connect(self._dynamipsPathBrowserSlot)
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox.stateChanged.connect(self._allocateHypervisorPerDeviceSlot)
|
||||
self.uiGhostIOSSupportCheckBox.stateChanged.connect(self._ghostIOSSupportSlot)
|
||||
self.uiRestoreDefaultsPushButton.clicked.connect(self._restoreDefaultsSlot)
|
||||
self.uiUseLocalServercheckBox.stateChanged.connect(self._useLocalServerSlot)
|
||||
self.uiTestSettingsPushButton.clicked.connect(self._testSettingsSlot)
|
||||
|
||||
#FIXME: temporally hide test button
|
||||
self.uiTestSettingsPushButton.hide()
|
||||
|
||||
def _dynamipsPathBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select Dynamips executable.
|
||||
"""
|
||||
|
||||
filter = ""
|
||||
file_filter = ""
|
||||
if sys.platform.startswith("win"):
|
||||
filter = "Executable (*.exe);;All files (*.*)"
|
||||
path = QtGui.QFileDialog.getOpenFileName(self, "Select Dynamips", ".", filter)
|
||||
file_filter = "Executable (*.exe);;All files (*.*)"
|
||||
|
||||
dynamips_path = shutil.which("dynamips")
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Select Dynamips", dynamips_path, file_filter)
|
||||
if not path:
|
||||
return
|
||||
|
||||
if self._checkDynamipsPath(path):
|
||||
self.uiDynamipsPathLineEdit.setText(path)
|
||||
|
||||
def _checkDynamipsPath(self, path):
|
||||
"""
|
||||
Checks that the Dynamips path is valid.
|
||||
|
||||
:param path: Dynamips path
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
if not os.path.exists(path):
|
||||
QtWidgets.QMessageBox.critical(self, "Dynamips", '"{}" does not exist'.format(path))
|
||||
return False
|
||||
|
||||
if not os.access(path, os.X_OK):
|
||||
QtGui.QMessageBox.critical(self, "Dynamips", "{} is not an executable".format(os.path.basename(path)))
|
||||
return
|
||||
QtWidgets.QMessageBox.critical(self, "Dynamips", "{} is not an executable".format(os.path.basename(path)))
|
||||
return False
|
||||
|
||||
self.uiDynamipsPathLineEdit.setText(path)
|
||||
|
||||
def _testSettingsSlot(self):
|
||||
|
||||
QtGui.QMessageBox.critical(self, "Test settings", "Sorry, not yet implemented!")
|
||||
|
||||
def _allocateHypervisorPerDeviceSlot(self, state):
|
||||
"""
|
||||
Slot to enable or not the memory usage limit per hypervisor and
|
||||
the per IOS allocation, based if the user want one hypervisor per IOS router.
|
||||
|
||||
:param state: state of the allocate hypervisor per device checkBox
|
||||
"""
|
||||
|
||||
if state:
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(False)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(False)
|
||||
else:
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(True)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(True)
|
||||
return True
|
||||
|
||||
def _ghostIOSSupportSlot(self, state):
|
||||
"""
|
||||
@@ -106,13 +100,23 @@ class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
|
||||
def _useLocalServerSlot(self, state):
|
||||
"""
|
||||
Slot to enable or not the QTreeWidget for remote servers.
|
||||
Slot to enable or not local server settings.
|
||||
"""
|
||||
|
||||
if state:
|
||||
self.uiRemoteServersTreeWidget.setEnabled(False)
|
||||
self.uiDynamipsPathLineEdit.setEnabled(True)
|
||||
self.uiDynamipsPathToolButton.setEnabled(True)
|
||||
self.uiAllocateAuxConsolePortsCheckBox.setEnabled(True)
|
||||
self.uiGhostIOSSupportCheckBox.setEnabled(True)
|
||||
self.uiMmapSupportCheckBox.setEnabled(True)
|
||||
self.uiSparseMemorySupportCheckBox.setEnabled(True)
|
||||
else:
|
||||
self.uiRemoteServersTreeWidget.setEnabled(True)
|
||||
self.uiDynamipsPathLineEdit.setEnabled(False)
|
||||
self.uiDynamipsPathToolButton.setEnabled(False)
|
||||
self.uiAllocateAuxConsolePortsCheckBox.setEnabled(False)
|
||||
self.uiGhostIOSSupportCheckBox.setEnabled(False)
|
||||
self.uiMmapSupportCheckBox.setEnabled(False)
|
||||
self.uiSparseMemorySupportCheckBox.setEnabled(False)
|
||||
|
||||
def _populateWidgets(self, settings):
|
||||
"""
|
||||
@@ -121,40 +125,13 @@ class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
:param settings: Dynamips settings
|
||||
"""
|
||||
|
||||
self.uiDynamipsPathLineEdit.setText(settings["path"])
|
||||
self.uiHypervisorStartPortSpinBox.setValue(settings["hypervisor_start_port_range"])
|
||||
self.uiHypervisorEndPortSpinBox.setValue(settings["hypervisor_end_port_range"])
|
||||
self.uiConsoleStartPortSpinBox.setValue(settings["console_start_port_range"])
|
||||
self.uiConsoleEndPortSpinBox.setValue(settings["console_end_port_range"])
|
||||
self.uiAuxStartPortSpinBox.setValue(settings["aux_start_port_range"])
|
||||
self.uiAuxEndPortSpinBox.setValue(settings["aux_end_port_range"])
|
||||
self.uiUDPStartPortSpinBox.setValue(settings["udp_start_port_range"])
|
||||
self.uiUDPEndPortSpinBox.setValue(settings["udp_end_port_range"])
|
||||
self.uiDynamipsPathLineEdit.setText(settings["dynamips_path"])
|
||||
self.uiAllocateAuxConsolePortsCheckBox.setChecked(settings["allocate_aux_console_ports"])
|
||||
self.uiUseLocalServercheckBox.setChecked(settings["use_local_server"])
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox.setChecked(settings["allocate_hypervisor_per_device"])
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setValue(settings["memory_usage_limit_per_hypervisor"])
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setChecked(settings["allocate_hypervisor_per_ios_image"])
|
||||
self.uiGhostIOSSupportCheckBox.setChecked(settings["ghost_ios_support"])
|
||||
self.uiMmapSupportCheckBox.setChecked(settings["mmap_support"])
|
||||
self.uiJITSharingSupportCheckBox.setChecked(settings["jit_sharing_support"])
|
||||
self.uiSparseMemorySupportCheckBox.setChecked(settings["sparse_memory_support"])
|
||||
|
||||
def _updateRemoteServersSlot(self):
|
||||
"""
|
||||
Adds/Updates the available remote servers.
|
||||
"""
|
||||
|
||||
servers = Servers.instance()
|
||||
self.uiRemoteServersTreeWidget.clear()
|
||||
for server in servers.remoteServers().values():
|
||||
host = server.host
|
||||
port = server.port
|
||||
item = QtGui.QTreeWidgetItem(self.uiRemoteServersTreeWidget)
|
||||
item.setText(0, host)
|
||||
item.setText(1, str(port))
|
||||
|
||||
self.uiRemoteServersTreeWidget.resizeColumnToContents(0)
|
||||
|
||||
def loadPreferences(self):
|
||||
"""
|
||||
Loads the Dynamips preferences.
|
||||
@@ -163,31 +140,20 @@ class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
dynamips_settings = Dynamips.instance().settings()
|
||||
self._populateWidgets(dynamips_settings)
|
||||
|
||||
servers = Servers.instance()
|
||||
servers.updated_signal.connect(self._updateRemoteServersSlot)
|
||||
self._updateRemoteServersSlot()
|
||||
|
||||
def savePreferences(self):
|
||||
"""
|
||||
Saves the Dynamips preferences.
|
||||
"""
|
||||
|
||||
new_settings = {}
|
||||
new_settings["path"] = self.uiDynamipsPathLineEdit.text()
|
||||
new_settings["hypervisor_start_port_range"] = self.uiHypervisorStartPortSpinBox.value()
|
||||
new_settings["hypervisor_end_port_range"] = self.uiHypervisorEndPortSpinBox.value()
|
||||
new_settings["console_start_port_range"] = self.uiConsoleStartPortSpinBox.value()
|
||||
new_settings["console_end_port_range"] = self.uiConsoleEndPortSpinBox.value()
|
||||
new_settings["aux_start_port_range"] = self.uiAuxStartPortSpinBox.value()
|
||||
new_settings["aux_end_port_range"] = self.uiAuxEndPortSpinBox.value()
|
||||
new_settings["udp_start_port_range"] = self.uiUDPStartPortSpinBox.value()
|
||||
new_settings["udp_end_port_range"] = self.uiUDPEndPortSpinBox.value()
|
||||
new_settings["use_local_server"] = self.uiUseLocalServercheckBox.isChecked()
|
||||
new_settings["allocate_hypervisor_per_device"] = self.uiAllocateHypervisorPerDeviceCheckBox.isChecked()
|
||||
new_settings["memory_usage_limit_per_hypervisor"] = self.uiMemoryUsageLimitPerHypervisorSpinBox.value()
|
||||
new_settings["allocate_hypervisor_per_ios_image"] = self.uiAllocateHypervisorPerIOSCheckBox.isChecked()
|
||||
new_settings["ghost_ios_support"] = self.uiGhostIOSSupportCheckBox.isChecked()
|
||||
new_settings["mmap_support"] = self.uiMmapSupportCheckBox.isChecked()
|
||||
new_settings["jit_sharing_support"] = self.uiJITSharingSupportCheckBox.isChecked()
|
||||
new_settings["sparse_memory_support"] = self.uiSparseMemorySupportCheckBox.isChecked()
|
||||
dynamips_path = self.uiDynamipsPathLineEdit.text().strip()
|
||||
if dynamips_path and self.uiUseLocalServercheckBox.isChecked() and not self._checkDynamipsPath(dynamips_path):
|
||||
return
|
||||
|
||||
new_settings = {"dynamips_path": dynamips_path,
|
||||
"allocate_aux_console_ports": self.uiAllocateAuxConsolePortsCheckBox.isChecked(),
|
||||
"use_local_server": self.uiUseLocalServercheckBox.isChecked(),
|
||||
"ghost_ios_support": self.uiGhostIOSSupportCheckBox.isChecked(),
|
||||
"mmap_support": self.uiMmapSupportCheckBox.isChecked(),
|
||||
"sparse_memory_support": self.uiSparseMemorySupportCheckBox.isChecked()}
|
||||
|
||||
Dynamips.instance().setSettings(new_settings)
|
||||
|
||||
@@ -19,19 +19,20 @@
|
||||
Configuration page for Dynamips Ethernet hubs.
|
||||
"""
|
||||
|
||||
from gns3.qt import QtGui
|
||||
from gns3.dialogs.node_configurator_dialog import ConfigurationError
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.dialogs.node_properties_dialog import ConfigurationError
|
||||
from ..ui.ethernet_hub_configuration_page_ui import Ui_ethernetHubConfigPageWidget
|
||||
|
||||
|
||||
class EthernetHubConfigurationPage(QtGui.QWidget, Ui_ethernetHubConfigPageWidget):
|
||||
class EthernetHubConfigurationPage(QtWidgets.QWidget, Ui_ethernetHubConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Ethernet hubs.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
def loadSettings(self, settings, node, group=False):
|
||||
@@ -65,7 +66,7 @@ class EthernetHubConfigurationPage(QtGui.QWidget, Ui_ethernetHubConfigPageWidget
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "Ethernet hub name cannot be empty!")
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "Ethernet hub name cannot be empty!")
|
||||
else:
|
||||
settings["name"] = name
|
||||
else:
|
||||
@@ -79,7 +80,7 @@ class EthernetHubConfigurationPage(QtGui.QWidget, Ui_ethernetHubConfigPageWidget
|
||||
for port in ports:
|
||||
if not port.isFree() and port.portNumber() > nbports:
|
||||
self.loadSettings(settings, node)
|
||||
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {}, please remove it first".format(port.name()))
|
||||
QtWidgets.QMessageBox.critical(self, node.name(), "A link is connected to port {}, please remove it first".format(port.name()))
|
||||
raise ConfigurationError()
|
||||
|
||||
settings["ports"] = []
|
||||
|
||||
@@ -19,19 +19,20 @@
|
||||
Configuration page for Dynamips Ethernet switches.
|
||||
"""
|
||||
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from ..utils.tree_widget_item import TreeWidgetItem
|
||||
from ..ui.ethernet_switch_configuration_page_ui import Ui_ethernetSwitchConfigPageWidget
|
||||
|
||||
|
||||
class EthernetSwitchConfigurationPage(QtGui.QWidget, Ui_ethernetSwitchConfigPageWidget):
|
||||
class EthernetSwitchConfigurationPage(QtWidgets.QWidget, Ui_ethernetSwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Ethernet switches.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self._ports = {}
|
||||
|
||||
@@ -113,7 +114,7 @@ class EthernetSwitchConfigurationPage(QtGui.QWidget, Ui_ethernetSwitchConfigPage
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if node_port.portNumber() == port and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
return
|
||||
del self._ports[port]
|
||||
self.uiPortsTreeWidget.takeTopLevelItem(self.uiPortsTreeWidget.indexOfTopLevelItem(item))
|
||||
@@ -167,7 +168,7 @@ class EthernetSwitchConfigurationPage(QtGui.QWidget, Ui_ethernetSwitchConfigPage
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "Ethernet switch name cannot be empty!")
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "Ethernet switch name cannot be empty!")
|
||||
else:
|
||||
settings["name"] = name
|
||||
else:
|
||||
|
||||
@@ -19,18 +19,19 @@
|
||||
Configuration page for Dynamips Frame Relay switches.
|
||||
"""
|
||||
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from ..ui.frame_relay_switch_configuration_page_ui import Ui_frameRelaySwitchConfigPageWidget
|
||||
|
||||
|
||||
class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfigPageWidget):
|
||||
class FrameRelaySwitchConfigurationPage(QtWidgets.QWidget, Ui_frameRelaySwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Frame Relay switches.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self._mapping = {}
|
||||
|
||||
@@ -65,7 +66,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
@@ -81,17 +82,17 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
destination_dlci = self.uiDestinationDLCISpinBox.value()
|
||||
|
||||
if source_port == destination_port:
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
|
||||
return
|
||||
|
||||
source = "{port}:{dlci}".format(port=source_port, dlci=source_dlci)
|
||||
destination = "{port}:{dlci}".format(port=destination_port, dlci=destination_dlci)
|
||||
|
||||
if source in self._mapping or destination in self._mapping:
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
|
||||
return
|
||||
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, source)
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -108,7 +109,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item:
|
||||
#connected_ports = self.node.getConnectedInterfaceList()
|
||||
# connected_ports = self.node.getConnectedInterfaceList()
|
||||
source = item.text(0)
|
||||
source_port = int(source.split(':')[0])
|
||||
destination = item.text(1)
|
||||
@@ -119,7 +120,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
node_ports = self._node.ports()
|
||||
for node_port in node_ports:
|
||||
if (node_port.portNumber() == source_port or node_port.portNumber() == destination_port) and not node_port.isFree():
|
||||
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
QtWidgets.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.name()))
|
||||
return
|
||||
|
||||
del self._mapping[source]
|
||||
@@ -144,7 +145,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
self._node = node
|
||||
|
||||
for source, destination in settings["mappings"].items():
|
||||
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiMappingTreeWidget)
|
||||
item.setText(0, source)
|
||||
item.setText(1, destination)
|
||||
self.uiMappingTreeWidget.addTopLevelItem(item)
|
||||
@@ -166,7 +167,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "Frame relay switch name cannot be empty!")
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "Frame relay switch name cannot be empty!")
|
||||
else:
|
||||
settings["name"] = name
|
||||
else:
|
||||
|
||||
@@ -21,23 +21,25 @@ Configuration page for Dynamips IOS routers.
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import pkg_resources
|
||||
|
||||
from gns3.qt import QtGui
|
||||
from gns3.dialogs.node_configurator_dialog import ConfigurationError
|
||||
from gns3.servers import Servers
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from gns3.dialogs.node_properties_dialog import ConfigurationError
|
||||
from gns3.dialogs.symbol_selection_dialog import SymbolSelectionDialog
|
||||
from gns3.node import Node
|
||||
from ..ui.ios_router_configuration_page_ui import Ui_iosRouterConfigPageWidget
|
||||
from ..settings import CHASSIS, ADAPTER_MATRIX, WIC_MATRIX
|
||||
|
||||
|
||||
class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
class IOSRouterConfigurationPage(QtWidgets.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for IOS routers.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
self._widget_slots = {0: self.uiSlot0comboBox,
|
||||
@@ -54,15 +56,46 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
|
||||
self.uiStartupConfigToolButton.clicked.connect(self._startupConfigBrowserSlot)
|
||||
self.uiPrivateConfigToolButton.clicked.connect(self._privateConfigBrowserSlot)
|
||||
self.uiSymbolToolButton.clicked.connect(self._symbolBrowserSlot)
|
||||
self.uiIOSImageToolButton.clicked.connect(self._iosImageBrowserSlot)
|
||||
self._server = None
|
||||
self._idle_valid = False
|
||||
idle_pc_rgx = QtCore.QRegExp("^(0x[0-9a-fA-F]{8})?$")
|
||||
validator = QtGui.QRegExpValidator(idle_pc_rgx, self)
|
||||
self.uiIdlepcLineEdit.setValidator(validator)
|
||||
self.uiIdlepcLineEdit.textChanged.connect(self._idlePCValidateSlot)
|
||||
self.uiIdlepcLineEdit.textChanged.emit(self.uiIdlepcLineEdit.text())
|
||||
self._default_configs_dir = Servers.instance().localServerSettings()["configs_path"]
|
||||
|
||||
# add the categories
|
||||
for name, category in Node.defaultCategories().items():
|
||||
self.uiCategoryComboBox.addItem(name, category)
|
||||
|
||||
def _idlePCValidateSlot(self):
|
||||
"""
|
||||
Slot to validate the entered Idle-PC Value
|
||||
"""
|
||||
|
||||
validator = self.uiIdlepcLineEdit.validator()
|
||||
state = validator.validate(self.uiIdlepcLineEdit.text(), 0)[0]
|
||||
if state == QtGui.QValidator.Acceptable:
|
||||
color = '#A2C964' # green
|
||||
self._idle_valid = True
|
||||
elif state == QtGui.QValidator.Intermediate:
|
||||
color = '#fff79a' # yellow
|
||||
self._idle_valid = False
|
||||
else:
|
||||
color = '#f6989d' # red
|
||||
self._idle_valid = False
|
||||
self.uiIdlepcLineEdit.setStyleSheet('QLineEdit { background-color: %s }' % color)
|
||||
|
||||
def _iosImageBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select an IOU image.
|
||||
Slot to open a file browser and select an IOS image.
|
||||
"""
|
||||
|
||||
from ..pages.ios_router_preferences_page import IOSRouterPreferencesPage
|
||||
path = IOSRouterPreferencesPage.getIOSImage(self)
|
||||
path = IOSRouterPreferencesPage.getIOSImage(self, self._server)
|
||||
if not path:
|
||||
return
|
||||
self.uiIOSImageLineEdit.clear()
|
||||
@@ -72,7 +105,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
image = os.path.basename(path)
|
||||
match = re.match("^(c[0-9]+)\\-\w+", image)
|
||||
if not match:
|
||||
QtGui.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
|
||||
return
|
||||
|
||||
detected_platform = match.group(1)
|
||||
@@ -88,26 +121,23 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
chassis = self.uiChassisTextLabel.text()
|
||||
|
||||
if detected_platform != platform:
|
||||
QtGui.QMessageBox.warning(self, "IOS image", "Using an IOS image made for another platform will likely not work!")
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "Using an IOS image made for another platform will likely not work!")
|
||||
|
||||
if detected_chassis and chassis and detected_chassis != chassis:
|
||||
QtGui.QMessageBox.warning(self, "IOS image", "Using an IOS image made for another chassis will likely not work!")
|
||||
QtWidgets.QMessageBox.warning(self, "IOS image", "Using an IOS image made for another chassis will likely not work!")
|
||||
|
||||
def _startupConfigBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select a startup-config file.
|
||||
"""
|
||||
|
||||
if hasattr(sys, "frozen"):
|
||||
config_dir = "configs"
|
||||
else:
|
||||
config_dir = pkg_resources.resource_filename("gns3", "configs")
|
||||
path = QtGui.QFileDialog.getOpenFileName(self, "Select a startup configuration", config_dir)
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Select a startup configuration", self._default_configs_dir)
|
||||
if not path:
|
||||
return
|
||||
|
||||
self._default_configs_dir = os.path.dirname(path)
|
||||
if not os.access(path, os.R_OK):
|
||||
QtGui.QMessageBox.critical(self, "Startup configuration", "Cannot read {}".format(path))
|
||||
QtWidgets.QMessageBox.critical(self, "Startup configuration", "Cannot read {}".format(path))
|
||||
return
|
||||
|
||||
self.uiStartupConfigLineEdit.clear()
|
||||
@@ -118,21 +148,31 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
Slot to open a file browser and select a private-config file.
|
||||
"""
|
||||
|
||||
if hasattr(sys, "frozen"):
|
||||
config_dir = "configs"
|
||||
else:
|
||||
config_dir = pkg_resources.resource_filename("gns3", "configs")
|
||||
path = QtGui.QFileDialog.getOpenFileName(self, "Select a private configuration", config_dir)
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Select a private configuration", self._default_configs_dir)
|
||||
if not path:
|
||||
return
|
||||
|
||||
self._default_configs_dir = os.path.dirname(path)
|
||||
if not os.access(path, os.R_OK):
|
||||
QtGui.QMessageBox.critical(self, "Private configuration", "Cannot read {}".format(path))
|
||||
QtWidgets.QMessageBox.critical(self, "Private configuration", "Cannot read {}".format(path))
|
||||
return
|
||||
|
||||
self.uiPrivateConfigLineEdit.clear()
|
||||
self.uiPrivateConfigLineEdit.setText(path)
|
||||
|
||||
def _symbolBrowserSlot(self):
|
||||
"""
|
||||
Slot to open the symbol browser and select a new symbol.
|
||||
"""
|
||||
|
||||
symbol_path = self.uiSymbolLineEdit.text()
|
||||
dialog = SymbolSelectionDialog(self, symbol=symbol_path)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
new_symbol_path = dialog.getSymbol()
|
||||
self.uiSymbolLineEdit.setText(new_symbol_path)
|
||||
self.uiSymbolLineEdit.setToolTip('<img src="{}"/>'.format(new_symbol_path))
|
||||
|
||||
def _loadAdapterConfig(self, platform, chassis, settings):
|
||||
"""
|
||||
Loads the adapter and WIC configuration.
|
||||
@@ -151,16 +191,17 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
for slot_number, slot_adapters in ADAPTER_MATRIX[platform][chassis].items():
|
||||
self._widget_slots[slot_number].setEnabled(True)
|
||||
|
||||
if type(slot_adapters) == str:
|
||||
if isinstance(slot_adapters, str):
|
||||
# only one default adapter for this slot.
|
||||
self._widget_slots[slot_number].addItem(slot_adapters)
|
||||
# elif platform == "c7200" and slot_number == 0 and settings["slot0"] != None:
|
||||
# # special case
|
||||
# self._widget_slots[slot_number].addItem(settings["slot0"])
|
||||
else:
|
||||
# list of adapters
|
||||
module_list = list(slot_adapters)
|
||||
self._widget_slots[slot_number].addItems([""] + module_list)
|
||||
if platform == "c7200" and slot_number == 0:
|
||||
# special case
|
||||
self._widget_slots[slot_number].addItems(module_list)
|
||||
else:
|
||||
self._widget_slots[slot_number].addItems([""] + module_list)
|
||||
|
||||
# set the combox box to the correct slot adapter if configured.
|
||||
if settings["slot" + str(slot_number)]:
|
||||
@@ -195,6 +236,11 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
:param group: indicates the settings apply to a group of routers
|
||||
"""
|
||||
|
||||
if node:
|
||||
self._server = node.server()
|
||||
else:
|
||||
self._server = Servers.instance().getServerFromString(settings["server"])
|
||||
|
||||
if not group:
|
||||
self.uiNameLineEdit.setText(settings["name"])
|
||||
|
||||
@@ -205,24 +251,16 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
self.uiConsolePortSpinBox.hide()
|
||||
|
||||
if "aux" in settings:
|
||||
self.uiAuxPortSpinBox.setValue(settings["aux"])
|
||||
if settings["aux"] is None:
|
||||
self.uiAuxPortSpinBox.setValue(0)
|
||||
else:
|
||||
self.uiAuxPortSpinBox.setValue(settings["aux"])
|
||||
else:
|
||||
self.uiAuxPortLabel.hide()
|
||||
self.uiAuxPortSpinBox.hide()
|
||||
|
||||
# load the startup-config
|
||||
self.uiStartupConfigLineEdit.setText(settings["startup_config"])
|
||||
|
||||
# load the private-config
|
||||
self.uiPrivateConfigLineEdit.setText(settings["private_config"])
|
||||
|
||||
# load the MAC address setting
|
||||
self.uiBaseMACLineEdit.setInputMask("HHHH.HHHH.HHHH;_")
|
||||
|
||||
# regexp = QtCore.QRegExp("([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}")
|
||||
# validator = QtGui.QRegExpValidator(regexp)
|
||||
# self.uiBaseMACLineEdit.setValidator(validator)
|
||||
|
||||
if settings["mac_addr"]:
|
||||
self.uiBaseMACLineEdit.setText(settings["mac_addr"])
|
||||
else:
|
||||
@@ -235,12 +273,6 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
self.uiIOSImageLabel.hide()
|
||||
self.uiIOSImageLineEdit.hide()
|
||||
self.uiIOSImageToolButton.hide()
|
||||
self.uiStartupConfigLabel.hide()
|
||||
self.uiStartupConfigLineEdit.hide()
|
||||
self.uiStartupConfigToolButton.hide()
|
||||
self.uiPrivateConfigLabel.hide()
|
||||
self.uiPrivateConfigLineEdit.hide()
|
||||
self.uiPrivateConfigToolButton.hide()
|
||||
self.uiConsolePortLabel.hide()
|
||||
self.uiConsolePortSpinBox.hide()
|
||||
self.uiAuxPortLabel.hide()
|
||||
@@ -248,6 +280,35 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
self.uiBaseMacLabel.hide()
|
||||
self.uiBaseMACLineEdit.hide()
|
||||
|
||||
if not node:
|
||||
# load the startup-config
|
||||
self.uiStartupConfigLineEdit.setText(settings["startup_config"])
|
||||
|
||||
# load the private-config
|
||||
self.uiPrivateConfigLineEdit.setText(settings["private_config"])
|
||||
|
||||
# load the symbol
|
||||
self.uiSymbolLineEdit.setText(settings["symbol"])
|
||||
self.uiSymbolLineEdit.setToolTip('<img src="{}"/>'.format(settings["symbol"]))
|
||||
|
||||
# load the category
|
||||
index = self.uiCategoryComboBox.findData(settings["category"])
|
||||
if index != -1:
|
||||
self.uiCategoryComboBox.setCurrentIndex(index)
|
||||
else:
|
||||
self.uiStartupConfigLabel.hide()
|
||||
self.uiStartupConfigLineEdit.hide()
|
||||
self.uiStartupConfigToolButton.hide()
|
||||
self.uiPrivateConfigLabel.hide()
|
||||
self.uiPrivateConfigLineEdit.hide()
|
||||
self.uiPrivateConfigToolButton.hide()
|
||||
self.uiSymbolLabel.hide()
|
||||
self.uiSymbolLineEdit.hide()
|
||||
self.uiSymbolToolButton.hide()
|
||||
self.uiCategoryComboBox.hide()
|
||||
self.uiCategoryLabel.hide()
|
||||
self.uiCategoryComboBox.hide()
|
||||
|
||||
# show the platform and chassis if applicable
|
||||
platform = settings["platform"]
|
||||
self.uiPlatformTextLabel.setText(platform)
|
||||
@@ -276,14 +337,13 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
if index != -1:
|
||||
self.uiNPEComboBox.setCurrentIndex(index)
|
||||
|
||||
if "sensors" in settings:
|
||||
if node:
|
||||
# load the sensor settings
|
||||
self.uiSensor1SpinBox.setValue(settings["sensors"][0])
|
||||
self.uiSensor2SpinBox.setValue(settings["sensors"][1])
|
||||
self.uiSensor3SpinBox.setValue(settings["sensors"][2])
|
||||
self.uiSensor4SpinBox.setValue(settings["sensors"][3])
|
||||
|
||||
if "power_supplies" in settings:
|
||||
if settings["power_supplies"][0] == 1:
|
||||
self.uiPowerSupply1ComboBox.setCurrentIndex(0)
|
||||
else:
|
||||
@@ -294,7 +354,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
else:
|
||||
self.uiPowerSupply2ComboBox.setCurrentIndex(1)
|
||||
else:
|
||||
self.uiTabWidget.removeTab(4) # environment tab
|
||||
self.uiTabWidget.removeTab(4) # environment tab
|
||||
|
||||
# all platforms but c7200 have the iomem feature
|
||||
# let"s hide these widgets.
|
||||
@@ -316,6 +376,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
self.uiNvramSpinBox.setValue(settings["nvram"])
|
||||
self.uiDisk0SpinBox.setValue(settings["disk0"])
|
||||
self.uiDisk1SpinBox.setValue(settings["disk1"])
|
||||
self.uiAutoDeleteCheckBox.setChecked(settings["auto_delete_disks"])
|
||||
|
||||
# load all the slots with configured adapters
|
||||
self._loadAdapterConfig(platform, chassis, settings)
|
||||
@@ -323,9 +384,6 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
# load the system ID (processor board ID in IOS) setting
|
||||
self.uiSystemIdLineEdit.setText(settings["system_id"])
|
||||
|
||||
# load the configuration register setting
|
||||
self.uiConfregLineEdit.setText(settings["confreg"])
|
||||
|
||||
if "exec_area" in settings:
|
||||
# load the exec area setting
|
||||
self.uiExecAreaSpinBox.setValue(settings["exec_area"])
|
||||
@@ -374,13 +432,13 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
node_ports = node.ports()
|
||||
for node_port in node_ports:
|
||||
# ports > 15 are WICs ones.
|
||||
if node_port.slotNumber() == slot_number and node_port.portNumber() <= 15 and not node_port.isFree():
|
||||
if node_port.adapterNumber() == slot_number and node_port.portNumber() <= 15 and not node_port.isFree():
|
||||
adapter = settings["slot" + str(slot_number)]
|
||||
index = self._widget_slots[slot_number].findText(adapter)
|
||||
if index != -1:
|
||||
self._widget_slots[slot_number].setCurrentIndex(index)
|
||||
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {} on adapter {}, please remove it first".format(node_port.name(),
|
||||
adapter))
|
||||
QtWidgets.QMessageBox.critical(self, node.name(), "A link is connected to port {} on adapter {}, please remove it first".format(node_port.name(),
|
||||
adapter))
|
||||
raise ConfigurationError()
|
||||
|
||||
def _checkForLinkConnectedToWIC(self, wic_number, settings, node):
|
||||
@@ -395,13 +453,13 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
node_ports = node.ports()
|
||||
for node_port in node_ports:
|
||||
# ports > 15 are WICs ones.
|
||||
if node_port.slotNumber() == wic_number and node_port.portNumber() > 15 and not node_port.isFree():
|
||||
if node_port.adapterNumber() == wic_number and node_port.portNumber() > 15 and not node_port.isFree():
|
||||
wic = settings["wic" + str(wic_number)]
|
||||
index = self._widget_wics[wic_number].findText(wic)
|
||||
if index != -1:
|
||||
self._widget_wics[wic_number].setCurrentIndex(index)
|
||||
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {} on {}, please remove it first".format(node_port.name(),
|
||||
wic))
|
||||
QtWidgets.QMessageBox.critical(self, node.name(), "A link is connected to port {} on {}, please remove it first".format(node_port.name(),
|
||||
wic))
|
||||
raise ConfigurationError()
|
||||
|
||||
def saveSettings(self, settings, node=None, group=False):
|
||||
@@ -413,63 +471,81 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
:param group: indicates the settings apply to a group of routers
|
||||
"""
|
||||
|
||||
#print("saving {}".format(group))
|
||||
|
||||
# these settings cannot be shared by nodes and updated
|
||||
# in the node configurator.
|
||||
|
||||
if not group:
|
||||
|
||||
# Check if the Idle-PC value has been validated okay
|
||||
if not self._idle_valid:
|
||||
idle_pc = self.uiIdlepcLineEdit.text()
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC", "{} is not a valid Idle-PC value ".format(idle_pc))
|
||||
raise ConfigurationError()
|
||||
|
||||
# set the device name
|
||||
name = self.uiNameLineEdit.text()
|
||||
if not name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "IOS router name cannot be empty!")
|
||||
elif node and not re.search(r"""^[\-\w]+$""", name):
|
||||
# IOS names must start with a letter, end with a letter or digit, and
|
||||
# have as interior characters only letters, digits, and hyphens.
|
||||
# They must be 63 characters or fewer.
|
||||
QtGui.QMessageBox.critical(self, "Name", "Invalid name detected for IOS router: {}".format(name))
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "IOS router name cannot be empty!")
|
||||
elif node and not node.validateHostname(name):
|
||||
QtWidgets.QMessageBox.critical(self, "Name", "Invalid name detected for IOS router: {}".format(name))
|
||||
else:
|
||||
settings["name"] = name
|
||||
|
||||
settings["console"] = self.uiConsolePortSpinBox.value()
|
||||
settings["aux"] = self.uiAuxPortSpinBox.value()
|
||||
|
||||
startup_config = self.uiStartupConfigLineEdit.text()
|
||||
if startup_config != settings["startup_config"]:
|
||||
if os.access(startup_config, os.R_OK):
|
||||
settings["startup_config"] = startup_config
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self, "Startup-config", "Cannot read the startup-config file")
|
||||
|
||||
private_config = self.uiPrivateConfigLineEdit.text()
|
||||
if private_config != settings["private_config"]:
|
||||
if os.access(private_config, os.R_OK):
|
||||
settings["private_config"] = private_config
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self, "Private-config", "Cannot read the private-config file")
|
||||
if "console" in settings:
|
||||
settings["console"] = self.uiConsolePortSpinBox.value()
|
||||
aux = self.uiAuxPortSpinBox.value()
|
||||
if aux:
|
||||
settings["aux"] = aux
|
||||
|
||||
# check and save the base MAC address
|
||||
#mac = self.uiBaseMACLineEdit.text()
|
||||
#if mac and not re.search(r"""^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$""", mac):
|
||||
# QtGui.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hhhh.hhhh.hhhh)")
|
||||
#elif mac != "":
|
||||
# settings["mac_addr"] = mac
|
||||
mac = self.uiBaseMACLineEdit.text()
|
||||
if mac != "..":
|
||||
if not re.search(r"""^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$""", mac):
|
||||
QtWidgets.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hhhh.hhhh.hhhh)")
|
||||
else:
|
||||
settings["mac_addr"] = mac
|
||||
elif not node:
|
||||
settings["mac_addr"] = ""
|
||||
|
||||
# save the IOS image path
|
||||
path = self.uiIOSImageLineEdit.text()
|
||||
#settings["path"] = path
|
||||
settings["image"] = path#os.path.basename(path)
|
||||
settings["image"] = self.uiIOSImageLineEdit.text()
|
||||
|
||||
else:
|
||||
del settings["name"]
|
||||
del settings["console"]
|
||||
del settings["aux"]
|
||||
del settings["mac_addr"]
|
||||
del settings["startup_config"]
|
||||
del settings["private_config"]
|
||||
if "startup_config" in settings:
|
||||
del settings["startup_config"]
|
||||
if "private_config" in settings:
|
||||
del settings["private_config"]
|
||||
del settings["image"]
|
||||
|
||||
if not node:
|
||||
startup_config = self.uiStartupConfigLineEdit.text().strip()
|
||||
if not startup_config:
|
||||
settings["startup_config"] = ""
|
||||
elif startup_config != settings["startup_config"]:
|
||||
if os.access(startup_config, os.R_OK):
|
||||
settings["startup_config"] = startup_config
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, "Startup-config", "Cannot read the startup-config file")
|
||||
|
||||
private_config = self.uiPrivateConfigLineEdit.text().strip()
|
||||
if not private_config:
|
||||
settings["private_config"] = ""
|
||||
elif private_config != settings["private_config"]:
|
||||
if os.access(private_config, os.R_OK):
|
||||
settings["private_config"] = private_config
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, "Private-config", "Cannot read the private-config file")
|
||||
|
||||
symbol_path = self.uiSymbolLineEdit.text()
|
||||
pixmap = QtGui.QPixmap(symbol_path)
|
||||
if pixmap.isNull():
|
||||
QtWidgets.QMessageBox.critical(self, "Symbol", "Invalid file or format not supported")
|
||||
else:
|
||||
settings["symbol"] = symbol_path
|
||||
|
||||
settings["category"] = self.uiCategoryComboBox.itemData(self.uiCategoryComboBox.currentIndex())
|
||||
|
||||
# get the platform and chassis if applicable
|
||||
platform = settings["platform"]
|
||||
if "chassis" in settings:
|
||||
@@ -480,24 +556,25 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
settings["midplane"] = self.uiMidplaneComboBox.currentText()
|
||||
settings["npe"] = self.uiNPEComboBox.currentText()
|
||||
|
||||
sensors = []
|
||||
sensors.append(self.uiSensor1SpinBox.value())
|
||||
sensors.append(self.uiSensor2SpinBox.value())
|
||||
sensors.append(self.uiSensor3SpinBox.value())
|
||||
sensors.append(self.uiSensor4SpinBox.value())
|
||||
settings["sensors"] = sensors
|
||||
if node:
|
||||
sensors = []
|
||||
sensors.append(self.uiSensor1SpinBox.value())
|
||||
sensors.append(self.uiSensor2SpinBox.value())
|
||||
sensors.append(self.uiSensor3SpinBox.value())
|
||||
sensors.append(self.uiSensor4SpinBox.value())
|
||||
settings["sensors"] = sensors
|
||||
|
||||
power_supplies = []
|
||||
if self.uiPowerSupply1ComboBox.currentIndex() == 0:
|
||||
power_supplies.append(1)
|
||||
else:
|
||||
power_supplies.append(0)
|
||||
power_supplies = []
|
||||
if self.uiPowerSupply1ComboBox.currentIndex() == 0:
|
||||
power_supplies.append(1)
|
||||
else:
|
||||
power_supplies.append(0)
|
||||
|
||||
if self.uiPowerSupply2ComboBox.currentIndex() == 0:
|
||||
power_supplies.append(1)
|
||||
else:
|
||||
power_supplies.append(0)
|
||||
settings["power_supplies"] = power_supplies
|
||||
if self.uiPowerSupply2ComboBox.currentIndex() == 0:
|
||||
power_supplies.append(1)
|
||||
else:
|
||||
power_supplies.append(0)
|
||||
settings["power_supplies"] = power_supplies
|
||||
else:
|
||||
# save the I/O memory setting
|
||||
settings["iomem"] = self.uiIomemSpinBox.value()
|
||||
@@ -507,19 +584,15 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
settings["nvram"] = self.uiNvramSpinBox.value()
|
||||
settings["disk0"] = self.uiDisk0SpinBox.value()
|
||||
settings["disk1"] = self.uiDisk1SpinBox.value()
|
||||
settings["auto_delete_disks"] = self.uiAutoDeleteCheckBox.isChecked()
|
||||
|
||||
# save the system ID (processor board ID in IOS) setting
|
||||
settings["system_id"] = self.uiSystemIdLineEdit.text()
|
||||
|
||||
# save the configuration register setting
|
||||
# TODO: check the format? 0xnnnn
|
||||
settings["confreg"] = self.uiConfregLineEdit.text()
|
||||
|
||||
# save the exec area setting
|
||||
settings["exec_area"] = self.uiExecAreaSpinBox.value()
|
||||
|
||||
# save the Idle-PC setting
|
||||
# TODO: check the format?
|
||||
settings["idlepc"] = self.uiIdlepcLineEdit.text()
|
||||
|
||||
# save the idlemax setting
|
||||
|
||||
@@ -22,34 +22,38 @@ Configuration page for IOS router preferences.
|
||||
import os
|
||||
import copy
|
||||
import sys
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import math
|
||||
import zipfile
|
||||
import logging
|
||||
|
||||
from gns3.qt import QtCore, QtGui
|
||||
from gns3.qt import QtCore, QtGui, QtWidgets
|
||||
from gns3.main_window import MainWindow
|
||||
from gns3.utils.progress_dialog import ProgressDialog
|
||||
from gns3.dialogs.symbol_selection_dialog import SymbolSelectionDialog
|
||||
from gns3.dialogs.configuration_dialog import ConfigurationDialog
|
||||
from gns3.cloud.utils import UploadFilesThread
|
||||
from gns3.utils.progress_dialog import ProgressDialog
|
||||
from gns3.image_manager import ImageManager
|
||||
|
||||
from .. import Dynamips
|
||||
from ..settings import IOS_ROUTER_SETTINGS
|
||||
from ..utils.decompress_ios import isIOSCompressed
|
||||
from ..utils.decompress_ios_thread import DecompressIOSThread
|
||||
from ..utils.decompress_ios_worker import DecompressIOSWorker
|
||||
from ..ui.ios_router_preferences_page_ui import Ui_IOSRouterPreferencesPageWidget
|
||||
from ..pages.ios_router_configuration_page import IOSRouterConfigurationPage
|
||||
from ..dialogs.ios_router_wizard import IOSRouterWizard
|
||||
|
||||
|
||||
class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget):
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IOSRouterPreferencesPage(QtWidgets.QWidget, Ui_IOSRouterPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for IOS routers.
|
||||
"""
|
||||
|
||||
_default_images_dir = ""
|
||||
|
||||
def __init__(self):
|
||||
QtGui.QWidget.__init__(self)
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
|
||||
self._main_window = MainWindow.instance()
|
||||
@@ -59,28 +63,26 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
self.uiNewIOSRouterPushButton.clicked.connect(self._iosRouterNewSlot)
|
||||
self.uiEditIOSRouterPushButton.clicked.connect(self._iosRouterEditSlot)
|
||||
self.uiDeleteIOSRouterPushButton.clicked.connect(self._iosRouterDeleteSlot)
|
||||
self.uiIOSRoutersTreeWidget.currentItemChanged.connect(self._iosRouterChangedSlot)
|
||||
self.uiIOSRoutersTreeWidget.itemPressed.connect(self._iosRouterPressedSlot)
|
||||
self.uiIOSRoutersTreeWidget.itemSelectionChanged.connect(self._iosRouterChangedSlot)
|
||||
self.uiDecompressIOSPushButton.clicked.connect(self._decompressIOSSlot)
|
||||
|
||||
def _iosRouterChangedSlot(self, current, previous):
|
||||
def _iosRouterChangedSlot(self):
|
||||
"""
|
||||
Loads a selected an IOS router from the tree widget.
|
||||
|
||||
:param current: current QTreeWidgetItem instance
|
||||
:param previous: ignored
|
||||
"""
|
||||
|
||||
if not current:
|
||||
self.uiIOSRouterInfoTreeWidget.clear()
|
||||
return
|
||||
selection = self.uiIOSRoutersTreeWidget.selectedItems()
|
||||
self.uiDeleteIOSRouterPushButton.setEnabled(len(selection) != 0)
|
||||
single_selected = len(selection) == 1
|
||||
self.uiEditIOSRouterPushButton.setEnabled(single_selected)
|
||||
self.uiDecompressIOSPushButton.setEnabled(single_selected)
|
||||
|
||||
self.uiEditIOSRouterPushButton.setEnabled(True)
|
||||
self.uiDeleteIOSRouterPushButton.setEnabled(True)
|
||||
self.uiDecompressIOSPushButton.setEnabled(True)
|
||||
key = current.data(0, QtCore.Qt.UserRole)
|
||||
ios_router = self._ios_routers[key]
|
||||
self._refreshInfo(ios_router)
|
||||
if single_selected:
|
||||
key = selection[0].data(0, QtCore.Qt.UserRole)
|
||||
ios_router = self._ios_routers[key]
|
||||
self._refreshInfo(ios_router)
|
||||
else:
|
||||
self.uiIOSRouterInfoTreeWidget.clear()
|
||||
|
||||
def _iosRouterNewSlot(self):
|
||||
"""
|
||||
@@ -94,51 +96,9 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
ios_settings = wizard.getSettings()
|
||||
key = "{server}:{name}".format(server=ios_settings["server"], name=ios_settings["name"])
|
||||
|
||||
# set the default base startup-config
|
||||
resource_name = "configs/ios_base_startup-config.txt"
|
||||
if hasattr(sys, "frozen") and os.path.isfile(resource_name):
|
||||
startup_config = os.path.normpath(resource_name)
|
||||
elif pkg_resources.resource_exists("gns3", resource_name):
|
||||
ios_base_config_path = pkg_resources.resource_filename("gns3", resource_name)
|
||||
startup_config = os.path.normpath(ios_base_config_path)
|
||||
|
||||
# set the default base private-config
|
||||
resource_name = "configs/ios_base_private-config.txt"
|
||||
if hasattr(sys, "frozen") and os.path.isfile(resource_name):
|
||||
private_config = os.path.normpath(resource_name)
|
||||
elif pkg_resources.resource_exists("gns3", resource_name):
|
||||
ios_base_config_path = pkg_resources.resource_filename("gns3", resource_name)
|
||||
private_config = os.path.normpath(ios_base_config_path)
|
||||
|
||||
ios_settings["startup_config"] = startup_config
|
||||
ios_settings["private_config"] = private_config
|
||||
|
||||
self._ios_routers[key] = IOS_ROUTER_SETTINGS.copy()
|
||||
self._ios_routers[key].update(ios_settings)
|
||||
|
||||
if ios_settings["server"] == 'cloud':
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
log.debug(ios_settings["image"])
|
||||
# Start uploading the image to cloud files
|
||||
|
||||
self._upload_image_progress_dialog = QtGui.QProgressDialog("Uploading image file {}".format(ios_settings['image']), "Cancel", 0, 0, parent=self)
|
||||
self._upload_image_progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
self._upload_image_progress_dialog.setWindowTitle("IOS image upload")
|
||||
self._upload_image_progress_dialog.show()
|
||||
try:
|
||||
src = self._ios_routers[key]['path']
|
||||
# Eg: images/IOS/c3745.img
|
||||
dst = 'images/IOS/{}'.format(self._ios_routers[key]['image'])
|
||||
upload_thread = UploadFilesThread(self, MainWindow.instance().cloudSettings(), [(src, dst)])
|
||||
upload_thread.completed.connect(self._imageUploadComplete)
|
||||
upload_thread.start()
|
||||
except Exception as e:
|
||||
self._upload_image_progress_dialog.reject()
|
||||
log.error(e)
|
||||
QtGui.QMessageBox.critical(self, "IOS image upload", "Error uploading IOS image: {}".format(e))
|
||||
|
||||
if ios_settings["platform"] == "c7200":
|
||||
self._ios_routers[key]["midplane"] = "vxr"
|
||||
self._ios_routers[key]["npe"] = "npe-400"
|
||||
@@ -156,18 +116,13 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
self._ios_routers[key][wic] = ios_settings[wic]
|
||||
|
||||
self._ios_routers[key].update(ios_settings)
|
||||
item = QtGui.QTreeWidgetItem(self.uiIOSRoutersTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiIOSRoutersTreeWidget)
|
||||
item.setText(0, self._ios_routers[key]["name"])
|
||||
item.setIcon(0, QtGui.QIcon(self._ios_routers[key]["default_symbol"]))
|
||||
item.setIcon(0, QtGui.QIcon(self._ios_routers[key]["symbol"]))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiIOSRoutersTreeWidget.setCurrentItem(item)
|
||||
|
||||
def _imageUploadComplete(self):
|
||||
if self._upload_image_progress_dialog.wasCanceled():
|
||||
return
|
||||
self._upload_image_progress_dialog.accept()
|
||||
|
||||
def _iosRouterEditSlot(self):
|
||||
"""
|
||||
Edits an IOS router.
|
||||
@@ -180,17 +135,21 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
dialog = ConfigurationDialog(ios_router["name"], ios_router, IOSRouterConfigurationPage(), parent=self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
# update the icon
|
||||
item.setIcon(0, QtGui.QIcon(ios_router["symbol"]))
|
||||
if ios_router["name"] != item.text(0):
|
||||
# rename the IOS router
|
||||
new_key = "{server}:{name}".format(server=ios_router["server"], name=ios_router["name"])
|
||||
if new_key in self._ios_routers:
|
||||
QtGui.QMessageBox.critical(self, "IOS router", "IOS router name {} already exists for server {}".format(ios_router["name"],
|
||||
ios_router["server"]))
|
||||
QtWidgets.QMessageBox.critical(self, "IOS router", "IOS router name {} already exists for server {}".format(ios_router["name"],
|
||||
ios_router["server"]))
|
||||
ios_router["name"] = item.text(0)
|
||||
return
|
||||
self._ios_routers[new_key] = self._ios_routers[key]
|
||||
del self._ios_routers[key]
|
||||
item.setText(0, ios_router["name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, new_key)
|
||||
|
||||
self._refreshInfo(ios_router)
|
||||
|
||||
def _iosRouterDeleteSlot(self):
|
||||
@@ -198,96 +157,99 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
Deletes an IOS router.
|
||||
"""
|
||||
|
||||
item = self.uiIOSRoutersTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
del self._ios_routers[key]
|
||||
self.uiIOSRoutersTreeWidget.takeTopLevelItem(self.uiIOSRoutersTreeWidget.indexOfTopLevelItem(item))
|
||||
if self._ios_routers == {}:
|
||||
self.uiEditIOSRouterPushButton.setEnabled(False)
|
||||
self.uiDeleteIOSRouterPushButton.setEnabled(False)
|
||||
self.uiDecompressIOSPushButton.setEnabled(False)
|
||||
for item in self.uiIOSRoutersTreeWidget.selectedItems():
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
ios_router = self._ios_routers[key]
|
||||
|
||||
del self._ios_routers[key]
|
||||
self.uiIOSRoutersTreeWidget.takeTopLevelItem(self.uiIOSRoutersTreeWidget.indexOfTopLevelItem(item))
|
||||
if self._ios_routers == {}:
|
||||
self.uiEditIOSRouterPushButton.setEnabled(False)
|
||||
self.uiDeleteIOSRouterPushButton.setEnabled(False)
|
||||
self.uiDecompressIOSPushButton.setEnabled(False)
|
||||
|
||||
def _imageUploadComplete(self):
|
||||
if self._upload_image_progress_dialog.wasCanceled():
|
||||
return
|
||||
self._upload_image_progress_dialog.accept()
|
||||
|
||||
@staticmethod
|
||||
def getIOSImage(parent):
|
||||
def getImageDirectory():
|
||||
return ImageManager.instance().getDirectoryForType("DYNAMIPS")
|
||||
|
||||
@classmethod
|
||||
def getIOSImage(cls, parent, server):
|
||||
"""
|
||||
|
||||
:param parent: parent widget
|
||||
:param server: The server where the image is located
|
||||
|
||||
:return: path to the IOS image or None
|
||||
"""
|
||||
|
||||
destination_directory = os.path.join(MainWindow.instance().settings()["images_path"], "IOS")
|
||||
path, _ = QtGui.QFileDialog.getOpenFileNameAndFilter(parent,
|
||||
"Select an IOS image",
|
||||
destination_directory,
|
||||
"All files (*.*);;IOS image (*.bin *.image)",
|
||||
"IOS image (*.bin *.image)")
|
||||
if not cls._default_images_dir:
|
||||
cls._default_images_dir = cls.getImageDirectory()
|
||||
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(parent,
|
||||
"Select an IOS image",
|
||||
cls._default_images_dir,
|
||||
"All files (*.*);;IOS image (*.bin *.image)",
|
||||
"IOS image (*.bin *.image)")
|
||||
|
||||
if not path:
|
||||
return
|
||||
cls._default_images_dir = os.path.dirname(path)
|
||||
|
||||
if not os.access(path, os.R_OK):
|
||||
QtGui.QMessageBox.critical(parent, "IOS image", "Cannot read {}".format(path))
|
||||
QtWidgets.QMessageBox.critical(parent, "IOS image", "Cannot read {}".format(path))
|
||||
return
|
||||
|
||||
if sys.platform.startswith('win'):
|
||||
# Dynamips (Cygwin acutally) doesn't like non ascii paths on Windows
|
||||
# Dynamips (Cygwin actually) doesn't like non ascii paths on Windows
|
||||
try:
|
||||
path.encode('ascii')
|
||||
except UnicodeEncodeError:
|
||||
QtGui.QMessageBox.warning(parent, "IOS image", "The IOS image filename should contains only ascii (English) characters.")
|
||||
QtWidgets.QMessageBox.warning(parent, "IOS image", "The IOS image filename should contains only ascii (English) characters.")
|
||||
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
# read the first 7 bytes of the file.
|
||||
elf_header_start = f.read(7)
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(parent, "IOS image", "Cannot read ELF magic number: {}".format(e))
|
||||
QtWidgets.QMessageBox.critical(parent, "IOS image", "Cannot read ELF magic number: {}".format(e))
|
||||
return
|
||||
|
||||
# file must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
||||
if elf_header_start != b'\x7fELF\x01\x02\x01':
|
||||
QtGui.QMessageBox.critical(parent, "IOS image", "Sorry, this is not a valid IOS image!")
|
||||
QtWidgets.QMessageBox.critical(parent, "IOS image", "Sorry, this is not a valid IOS image!")
|
||||
return
|
||||
|
||||
try:
|
||||
os.makedirs(destination_directory)
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.makedirs(cls.getImageDirectory(), exist_ok=True)
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(parent, "IOS images directory", "Could not create the IOS images directory {}: {}".format(destination_directory, str(e)))
|
||||
QtWidgets.QMessageBox.critical(parent, "IOS images directory", "Could not create the IOS images directory {}: {}".format(destination_directory, e))
|
||||
return
|
||||
|
||||
if isIOSCompressed(path):
|
||||
reply = QtGui.QMessageBox.question(parent, "IOS image", "Would you like to decompress this IOS image?",
|
||||
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.Yes:
|
||||
decompressed_image_path = os.path.join(destination_directory, os.path.basename(os.path.splitext(path)[0] + ".image"))
|
||||
thread = DecompressIOSThread(path, decompressed_image_path)
|
||||
progress_dialog = ProgressDialog(thread,
|
||||
compressed = False
|
||||
try:
|
||||
compressed = isIOSCompressed(path)
|
||||
except (OSError, ValueError):
|
||||
pass # ignore errors if we cannot find out the IOS image is compressed.
|
||||
if compressed:
|
||||
reply = QtWidgets.QMessageBox.question(parent, "IOS image", "Would you like to decompress this IOS image?", QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
decompressed_image_path = os.path.join(cls.getImageDirectory(), os.path.basename(os.path.splitext(path)[0] + ".image"))
|
||||
worker = DecompressIOSWorker(path, decompressed_image_path)
|
||||
progress_dialog = ProgressDialog(worker,
|
||||
"IOS image",
|
||||
"Decompressing IOS image {}...".format(os.path.basename(path)),
|
||||
"Cancel", busy=True, parent=parent)
|
||||
progress_dialog.show()
|
||||
if progress_dialog.exec_() is not False:
|
||||
path = decompressed_image_path
|
||||
thread.wait()
|
||||
|
||||
if os.path.dirname(path) != destination_directory:
|
||||
# the IOS image is not in the default images directory
|
||||
new_destination_path = os.path.join(destination_directory, os.path.basename(path))
|
||||
try:
|
||||
# try to create a symbolic link to it
|
||||
symlink_path = new_destination_path
|
||||
os.symlink(path, symlink_path)
|
||||
path = symlink_path
|
||||
except (OSError, NotImplementedError):
|
||||
# if unsuccessful, then copy the IOS image itself
|
||||
try:
|
||||
shutil.copyfile(path, new_destination_path)
|
||||
path = new_destination_path
|
||||
except OSError:
|
||||
pass
|
||||
path = ImageManager.instance().askCopyUploadImage(parent, path, server, "DYNAMIPS")
|
||||
|
||||
return path
|
||||
|
||||
@@ -309,7 +271,7 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
decompressed_size += zip_info.file_size
|
||||
else:
|
||||
decompressed_size = os.path.getsize(path)
|
||||
except OSError:
|
||||
except (zipfile.BadZipFile, OSError):
|
||||
return 0
|
||||
|
||||
# get the size in MB
|
||||
@@ -317,46 +279,6 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
# round up to the closest multiple of 32 (step of the RAM SpinBox)
|
||||
return math.ceil(decompressed_size / 32) * 32
|
||||
|
||||
def _startupConfigBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select a startup-config file.
|
||||
"""
|
||||
|
||||
if hasattr(sys, "frozen"):
|
||||
config_dir = "configs"
|
||||
else:
|
||||
config_dir = pkg_resources.resource_filename("gns3", "configs")
|
||||
path = QtGui.QFileDialog.getOpenFileName(self, "Select a startup configuration", config_dir)
|
||||
if not path:
|
||||
return
|
||||
|
||||
if not os.access(path, os.R_OK):
|
||||
QtGui.QMessageBox.critical(self, "Startup configuration", "Cannot read {}".format(path))
|
||||
return
|
||||
|
||||
self.uiStartupConfigLineEdit.clear()
|
||||
self.uiStartupConfigLineEdit.setText(path)
|
||||
|
||||
def _privateConfigBrowserSlot(self):
|
||||
"""
|
||||
Slot to open a file browser and select a private-config file.
|
||||
"""
|
||||
|
||||
if hasattr(sys, "frozen"):
|
||||
config_dir = "configs"
|
||||
else:
|
||||
config_dir = pkg_resources.resource_filename("gns3", "configs")
|
||||
path = QtGui.QFileDialog.getOpenFileName(self, "Select a private configuration", config_dir)
|
||||
if not path:
|
||||
return
|
||||
|
||||
if not os.access(path, os.R_OK):
|
||||
QtGui.QMessageBox.critical(self, "Private configuration", "Cannot read {}".format(path))
|
||||
return
|
||||
|
||||
self.uiPrivateConfigLineEdit.clear()
|
||||
self.uiPrivateConfigLineEdit.setText(path)
|
||||
|
||||
def _decompressIOSSlot(self):
|
||||
"""
|
||||
Slot to decompress an IOS image.
|
||||
@@ -366,34 +288,43 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
ios_router = self._ios_routers[key]
|
||||
path = ios_router["path"]
|
||||
path = ios_router["image"]
|
||||
if not os.path.isfile(path):
|
||||
QtGui.QMessageBox.critical(self, "IOS image", "IOS image file {} is does not exist".format(path))
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "IOS image file {} is does not exist".format(path))
|
||||
return
|
||||
if not isIOSCompressed(path):
|
||||
QtGui.QMessageBox.critical(self, "IOS image", "IOS image {} is not compressed".format(os.path.basename(path)))
|
||||
try:
|
||||
if not isIOSCompressed(path):
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "IOS image {} is not compressed".format(os.path.basename(path)))
|
||||
return
|
||||
except OSError as e:
|
||||
# errno 22, invalid argument means the file system where the IOS image is located doesn't support mmap
|
||||
if e.errno == 22:
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "IOS image {} cannot be memory mapped, most likely because the file system doesn't support it".format(os.path.basename(path)))
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "Could not determine if the IOS image is compressed: {}".format(e))
|
||||
return
|
||||
except ValueError as e:
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "Could not determine if the IOS image is compressed: {}".format(e))
|
||||
return
|
||||
|
||||
decompressed_image_path = os.path.splitext(path)[0] + ".image"
|
||||
if os.path.isfile(decompressed_image_path):
|
||||
QtGui.QMessageBox.critical(self, "IOS image", "Decompressed IOS image {} already exist".format(os.path.basename(decompressed_image_path)))
|
||||
QtWidgets.QMessageBox.critical(self, "IOS image", "Decompressed IOS image {} already exist".format(os.path.basename(decompressed_image_path)))
|
||||
return
|
||||
|
||||
thread = DecompressIOSThread(path, decompressed_image_path)
|
||||
progress_dialog = ProgressDialog(thread,
|
||||
worker = DecompressIOSWorker(path, decompressed_image_path)
|
||||
progress_dialog = ProgressDialog(worker,
|
||||
"IOS image",
|
||||
"Decompressing IOS image {}...".format(path),
|
||||
"Cancel", busy=True, parent=self)
|
||||
progress_dialog.show()
|
||||
if progress_dialog.exec_() is not False:
|
||||
ios_router["path"] = decompressed_image_path
|
||||
ios_router["image"] = os.path.basename(decompressed_image_path)
|
||||
ios_router["image"] = decompressed_image_path
|
||||
self._refreshInfo(ios_router)
|
||||
thread.wait()
|
||||
|
||||
def _createSectionItem(self, name):
|
||||
|
||||
section_item = QtGui.QTreeWidgetItem(self.uiIOSRouterInfoTreeWidget)
|
||||
section_item = QtWidgets.QTreeWidgetItem(self.uiIOSRouterInfoTreeWidget)
|
||||
section_item.setText(0, name)
|
||||
font = section_item.font(0)
|
||||
font.setBold(True)
|
||||
@@ -406,37 +337,38 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
|
||||
# fill out the General section
|
||||
section_item = self._createSectionItem("General")
|
||||
QtGui.QTreeWidgetItem(section_item, ["Name:", ios_router["name"]])
|
||||
QtGui.QTreeWidgetItem(section_item, ["Server:", ios_router["server"]])
|
||||
QtGui.QTreeWidgetItem(section_item, ["Platform:", ios_router["platform"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Name:", ios_router["name"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Server:", ios_router["server"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Platform:", ios_router["platform"]])
|
||||
if ios_router["chassis"]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["Chassis:", ios_router["chassis"]])
|
||||
QtGui.QTreeWidgetItem(section_item, ["Image:", ios_router["image"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Chassis:", ios_router["chassis"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Image:", ios_router["image"]])
|
||||
if ios_router["idlepc"]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["Idle-PC:", ios_router["idlepc"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Idle-PC:", ios_router["idlepc"]])
|
||||
if ios_router["startup_config"]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["Startup-config:", ios_router["startup_config"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Startup-config:", ios_router["startup_config"]])
|
||||
if ios_router["private_config"]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["Private-config:", ios_router["private_config"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Private-config:", ios_router["private_config"]])
|
||||
if ios_router["platform"] == "c7200":
|
||||
QtGui.QTreeWidgetItem(section_item, ["Midplane:", ios_router["midplane"]])
|
||||
QtGui.QTreeWidgetItem(section_item, ["NPE:", ios_router["npe"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Midplane:", ios_router["midplane"]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["NPE:", ios_router["npe"]])
|
||||
|
||||
# fill out the Memories and disk section
|
||||
section_item = self._createSectionItem("Memories and disks")
|
||||
QtGui.QTreeWidgetItem(section_item, ["RAM:", "{} MiB".format(ios_router["ram"])])
|
||||
QtGui.QTreeWidgetItem(section_item, ["NVRAM:", "{} KiB".format(ios_router["nvram"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["RAM:", "{} MiB".format(ios_router["ram"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["NVRAM:", "{} KiB".format(ios_router["nvram"])])
|
||||
if "iomem" in ios_router and ios_router["iomem"]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["I/O memory:", "{}%".format(ios_router["iomem"])])
|
||||
QtGui.QTreeWidgetItem(section_item, ["PCMCIA disk0:", "{} MiB".format(ios_router["disk0"])])
|
||||
QtGui.QTreeWidgetItem(section_item, ["PCMCIA disk1:", "{} MiB".format(ios_router["disk1"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["I/O memory:", "{}%".format(ios_router["iomem"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["PCMCIA disk0:", "{} MiB".format(ios_router["disk0"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["PCMCIA disk1:", "{} MiB".format(ios_router["disk1"])])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Auto delete:", "{}".format(ios_router["auto_delete_disks"])])
|
||||
|
||||
# fill out the Adapters section
|
||||
section_item = self._createSectionItem("Adapters")
|
||||
for slot_id in range(0, 7):
|
||||
slot = "slot{}".format(slot_id)
|
||||
if slot in ios_router and ios_router[slot]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["Slot {}:".format(slot_id), ios_router[slot]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["Slot {}:".format(slot_id), ios_router[slot]])
|
||||
if section_item.childCount() == 0:
|
||||
self.uiIOSRouterInfoTreeWidget.takeTopLevelItem(self.uiIOSRouterInfoTreeWidget.indexOfTopLevelItem(section_item))
|
||||
|
||||
@@ -445,7 +377,7 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
for wic_id in range(0, 3):
|
||||
wic = "wic{}".format(wic_id)
|
||||
if wic in ios_router and ios_router[wic]:
|
||||
QtGui.QTreeWidgetItem(section_item, ["WIC {}:".format(wic_id), ios_router[wic]])
|
||||
QtWidgets.QTreeWidgetItem(section_item, ["WIC {}:".format(wic_id), ios_router[wic]])
|
||||
if section_item.childCount() == 0:
|
||||
self.uiIOSRouterInfoTreeWidget.takeTopLevelItem(self.uiIOSRouterInfoTreeWidget.indexOfTopLevelItem(section_item))
|
||||
|
||||
@@ -453,48 +385,6 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
self.uiIOSRouterInfoTreeWidget.resizeColumnToContents(0)
|
||||
self.uiIOSRouterInfoTreeWidget.resizeColumnToContents(1)
|
||||
|
||||
def _iosRouterPressedSlot(self, item, column):
|
||||
"""
|
||||
Slot for item pressed.
|
||||
|
||||
:param item: ignored
|
||||
:param column: ignored
|
||||
"""
|
||||
|
||||
if QtGui.QApplication.mouseButtons() & QtCore.Qt.RightButton:
|
||||
self._showContextualMenu()
|
||||
|
||||
def _showContextualMenu(self):
|
||||
"""
|
||||
Contextual menu.
|
||||
"""
|
||||
|
||||
menu = QtGui.QMenu()
|
||||
change_symbol_action = QtGui.QAction("Change symbol", menu)
|
||||
change_symbol_action.setIcon(QtGui.QIcon(":/icons/node_conception.svg"))
|
||||
self.connect(change_symbol_action, QtCore.SIGNAL('triggered()'), self._changeSymbolSlot)
|
||||
menu.addAction(change_symbol_action)
|
||||
menu.exec_(QtGui.QCursor.pos())
|
||||
|
||||
def _changeSymbolSlot(self):
|
||||
"""
|
||||
Change a symbol for an IOS router.
|
||||
"""
|
||||
|
||||
dialog = SymbolSelectionDialog(self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
normal_symbol, selected_symbol = dialog.getSymbols()
|
||||
category = dialog.getCategory()
|
||||
item = self.uiIOSRoutersTreeWidget.currentItem()
|
||||
if item:
|
||||
item.setIcon(0, QtGui.QIcon(normal_symbol))
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
ios_router = self._ios_routers[key]
|
||||
ios_router["default_symbol"] = normal_symbol
|
||||
ios_router["hover_symbol"] = selected_symbol
|
||||
ios_router["category"] = category
|
||||
|
||||
def loadPreferences(self):
|
||||
"""
|
||||
Loads the IOS router preferences.
|
||||
@@ -505,9 +395,9 @@ class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget)
|
||||
self._items.clear()
|
||||
|
||||
for key, ios_router in self._ios_routers.items():
|
||||
item = QtGui.QTreeWidgetItem(self.uiIOSRoutersTreeWidget)
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiIOSRoutersTreeWidget)
|
||||
item.setText(0, ios_router["name"])
|
||||
item.setIcon(0, QtGui.QIcon(ios_router["default_symbol"]))
|
||||
item.setIcon(0, QtGui.QIcon(ios_router["symbol"]))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
self._items.append(item)
|
||||
|
||||
|
||||
@@ -21,73 +21,19 @@ Default Dynamips settings.
|
||||
|
||||
from gns3.node import Node
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
# default path to Dynamips executable
|
||||
if sys.platform.startswith("win"):
|
||||
DEFAULT_DYNAMIPS_PATH = r"dynamips\dynamips.exe"
|
||||
elif sys.platform.startswith("darwin") and hasattr(sys, "frozen"):
|
||||
DEFAULT_DYNAMIPS_PATH = os.path.join(os.getcwd(), "dynamips")
|
||||
else:
|
||||
paths = [os.getcwd()] + os.environ["PATH"].split(os.pathsep)
|
||||
# look for dynamips in the current working directory and $PATH
|
||||
DEFAULT_DYNAMIPS_PATH = "dynamips"
|
||||
for path in paths:
|
||||
try:
|
||||
if "dynamips" in os.listdir(path) and os.access(os.path.join(path, "dynamips"), os.X_OK):
|
||||
DEFAULT_DYNAMIPS_PATH = os.path.join(path, "dynamips")
|
||||
break
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
DYNAMIPS_SETTINGS = {
|
||||
"path": DEFAULT_DYNAMIPS_PATH,
|
||||
"hypervisor_start_port_range": 7200,
|
||||
"hypervisor_end_port_range": 7700,
|
||||
"console_start_port_range": 2001,
|
||||
"console_end_port_range": 2500,
|
||||
"aux_start_port_range": 2501,
|
||||
"aux_end_port_range": 3000,
|
||||
"udp_start_port_range": 10001,
|
||||
"udp_end_port_range": 20000,
|
||||
"dynamips_path": "",
|
||||
"allocate_aux_console_ports": False,
|
||||
"use_local_server": True,
|
||||
"allocate_hypervisor_per_device": True,
|
||||
"memory_usage_limit_per_hypervisor": 1024,
|
||||
"allocate_hypervisor_per_ios_image": True,
|
||||
"ghost_ios_support": True,
|
||||
"jit_sharing_support": False,
|
||||
"sparse_memory_support": True,
|
||||
"mmap_support": True,
|
||||
}
|
||||
|
||||
DYNAMIPS_SETTING_TYPES = {
|
||||
"path": str,
|
||||
"hypervisor_start_port_range": int,
|
||||
"hypervisor_end_port_range": int,
|
||||
"console_start_port_range": int,
|
||||
"console_end_port_range": int,
|
||||
"aux_start_port_range": int,
|
||||
"aux_end_port_range": int,
|
||||
"udp_start_port_range": int,
|
||||
"udp_end_port_range": int,
|
||||
"use_local_server": bool,
|
||||
"allocate_hypervisor_per_device": bool,
|
||||
"memory_usage_limit_per_hypervisor": int,
|
||||
"allocate_hypervisor_per_ios_image": bool,
|
||||
"ghost_ios_support": bool,
|
||||
"jit_sharing_support": bool,
|
||||
"sparse_memory_support": bool,
|
||||
"mmap_support": bool,
|
||||
}
|
||||
|
||||
IOS_ROUTER_SETTINGS = {
|
||||
"name": "",
|
||||
"path": "",
|
||||
"image": "",
|
||||
"default_symbol": ":/symbols/router.normal.svg",
|
||||
"hover_symbol": ":/symbols/router.selected.svg",
|
||||
"symbol": ":/symbols/router.svg",
|
||||
"category": Node.routers,
|
||||
"startup_config": "",
|
||||
"private_config": "",
|
||||
@@ -100,51 +46,49 @@ IOS_ROUTER_SETTINGS = {
|
||||
"mmap": True,
|
||||
"sparsemem": True,
|
||||
"ram": 128,
|
||||
"nvram": 256,
|
||||
"nvram": 128,
|
||||
"mac_addr": "",
|
||||
"disk0": 1,
|
||||
"disk0": 0,
|
||||
"disk1": 0,
|
||||
"confreg": "0x2102",
|
||||
"auto_delete_disks": False,
|
||||
"system_id": "FTX0945W0MY",
|
||||
"server": "local"
|
||||
}
|
||||
|
||||
IOS_ROUTER_SETTING_TYPES = {
|
||||
"name": str,
|
||||
"path": str,
|
||||
"image": str,
|
||||
"default_symbol": str,
|
||||
"hover_symbol": str,
|
||||
"category": int,
|
||||
"startup_config": str,
|
||||
"private_config": str,
|
||||
"platform": str,
|
||||
"chassis": str,
|
||||
"idlepc": str,
|
||||
"idlemax": int,
|
||||
"idlesleep": int,
|
||||
"exec_area": int,
|
||||
"mmap": bool,
|
||||
"sparsemem": bool,
|
||||
"ram": int,
|
||||
"nvram": int,
|
||||
"mac_addr": str,
|
||||
"disk0": int,
|
||||
"disk1": int,
|
||||
"confreg": str,
|
||||
"system_id": str,
|
||||
"server": str
|
||||
}
|
||||
|
||||
# supported platforms with the default RAM value
|
||||
PLATFORMS_DEFAULT_RAM = {"c1700": 64,
|
||||
"c2600": 64,
|
||||
"c2691": 128,
|
||||
"c3600": 128,
|
||||
PLATFORMS_DEFAULT_RAM = {"c1700": 160,
|
||||
"c2600": 160,
|
||||
"c2691": 192,
|
||||
"c3600": 192,
|
||||
"c3725": 128,
|
||||
"c3745": 128,
|
||||
"c3745": 256,
|
||||
"c7200": 512}
|
||||
|
||||
# supported platforms with the default NVRAM value
|
||||
PLATFORMS_DEFAULT_NVRAM = {"c1700": 128,
|
||||
"c2600": 128,
|
||||
"c2691": 256,
|
||||
"c3600": 256,
|
||||
"c3725": 256,
|
||||
"c3745": 256,
|
||||
"c7200": 512}
|
||||
|
||||
DEFAULT_IDLEPC = {"7f4ae12a098391bc0edcaf4f44caaf9d": "0x80358a60", # c1700-adventerprisek9-mz.124-25d
|
||||
"3aaecd2222e812c16c211bc9f7c77512": "0x824a4dc4", # c1700-adventerprisek9-mz.124-15.T14
|
||||
"062a32e9e3f59aeec930ea5694fda9c9": "0x80519c48", # c2600-adventerprisek9-mz.124-25d
|
||||
"483e3a579a5144ec23f2f160d4b0c0e2": "0x8027ec88", # c2600-adventerprisek9-mz.124-15.T14
|
||||
"37b444b29191630e5b688f002de2171c": "0x603a8bac", # c3620-a3jk8s-mz.122-26c
|
||||
"493c4ef6578801d74d715e7d11596964": "0x6050b114", # c3640-a3js-mz.124-25d
|
||||
"b88ee1b2ed182737395db2df27f34a33": "0x606071f8", # c3660-a3jk9s-mz.124-25d
|
||||
"daed99f508fd42dbaacf711e560643ed": "0x6076e0b4", # c3660-a3jk9s-mz.124-15.T14
|
||||
"8dc8486065de63883f29c85825a2f18c": "0x60a48cb8", # c2691-adventerprisek9-mz.124-25d
|
||||
"e7ee5a4a57ed1433e5f73ba6e7695c90": "0x60bcf9f8", # c2691-adventerprisek9-mz.124-15.T14
|
||||
"606484061b9e52e71d4f4ddab9af19e7": "0x602467a4", # c3725-adventerprisek9-mz.124-25d
|
||||
"64f8c427ed48fd21bd02cf1ff254c4eb": "0x60c09aa0", # c3725-adventerprisek9-mz.124-15.T14
|
||||
"ddbaf74274822b50fa9670e10c75b08f": "0x60aa1da0", # c3745-adventerprisek9-mz.124-25d
|
||||
"4af2e752220ed1397924150ff7bbe4ce": "0x602701e4", # c3745-adventerprisek9-mz.124-15.T14
|
||||
"6b89d0d804e1f2bb5b8bda66b5692047": "0x606df838"} # c7200-adventerprisek9-mz.124-24.T5
|
||||
|
||||
# platforms with supported chassis
|
||||
CHASSIS = {"c1700": ("1720", "1721", "1750", "1751", "1760"),
|
||||
"c2600": ("2610", "2611", "2620", "2621", "2610XM", "2611XM", "2620XM", "2621XM", "2650XM", "2651XM"),
|
||||
@@ -191,7 +135,7 @@ C7200_PAS = (
|
||||
IO_C7200 = ("C7200-IO-FE",
|
||||
"C7200-IO-2FE",
|
||||
"C7200-IO-GE-E"
|
||||
)
|
||||
)
|
||||
|
||||
"""
|
||||
Build the adapter compatibility matrix:
|
||||
|
||||
@@ -1,62 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/atm_bridge_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/dynamips/ui/atm_bridge_configuration_page.ui'
|
||||
#
|
||||
# Created: Sun Mar 16 11:16:57 2014
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Wed Jul 15 12:22:32 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_atmBridgeConfigPageWidget(object):
|
||||
def setupUi(self, atmBridgeConfigPageWidget):
|
||||
atmBridgeConfigPageWidget.setObjectName(_fromUtf8("atmBridgeConfigPageWidget"))
|
||||
atmBridgeConfigPageWidget.setObjectName("atmBridgeConfigPageWidget")
|
||||
atmBridgeConfigPageWidget.resize(432, 358)
|
||||
self.gridLayout_2 = QtGui.QGridLayout(atmBridgeConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.uiMappingGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
|
||||
self.uiMappingGroupBox.setObjectName(_fromUtf8("uiMappingGroupBox"))
|
||||
self.vboxlayout = QtGui.QVBoxLayout(self.uiMappingGroupBox)
|
||||
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
|
||||
self.uiMappingTreeWidget = QtGui.QTreeWidget(self.uiMappingGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(atmBridgeConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiMappingGroupBox = QtWidgets.QGroupBox(atmBridgeConfigPageWidget)
|
||||
self.uiMappingGroupBox.setObjectName("uiMappingGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiMappingGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(self.uiMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiMappingTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiMappingTreeWidget.setRootIsDecorated(False)
|
||||
self.uiMappingTreeWidget.setObjectName(_fromUtf8("uiMappingTreeWidget"))
|
||||
self.uiMappingTreeWidget.setObjectName("uiMappingTreeWidget")
|
||||
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiMappingGroupBox, 0, 2, 3, 1)
|
||||
self.uiEthernetGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.uiEthernetGroupBox = QtWidgets.QGroupBox(atmBridgeConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiEthernetGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiEthernetGroupBox.setObjectName(_fromUtf8("uiEthernetGroupBox"))
|
||||
self.gridlayout = QtGui.QGridLayout(self.uiEthernetGroupBox)
|
||||
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
|
||||
self.uiEthernetPortLabel = QtGui.QLabel(self.uiEthernetGroupBox)
|
||||
self.uiEthernetPortLabel.setObjectName(_fromUtf8("uiEthernetPortLabel"))
|
||||
self.uiEthernetGroupBox.setObjectName("uiEthernetGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiEthernetGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiEthernetPortLabel = QtWidgets.QLabel(self.uiEthernetGroupBox)
|
||||
self.uiEthernetPortLabel.setObjectName("uiEthernetPortLabel")
|
||||
self.gridlayout.addWidget(self.uiEthernetPortLabel, 0, 0, 1, 1)
|
||||
self.uiEthernetPortSpinBox = QtGui.QSpinBox(self.uiEthernetGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiEthernetPortSpinBox = QtWidgets.QSpinBox(self.uiEthernetGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -64,23 +50,23 @@ class Ui_atmBridgeConfigPageWidget(object):
|
||||
self.uiEthernetPortSpinBox.setMinimum(0)
|
||||
self.uiEthernetPortSpinBox.setMaximum(65535)
|
||||
self.uiEthernetPortSpinBox.setProperty("value", 1)
|
||||
self.uiEthernetPortSpinBox.setObjectName(_fromUtf8("uiEthernetPortSpinBox"))
|
||||
self.uiEthernetPortSpinBox.setObjectName("uiEthernetPortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiEthernetPortSpinBox, 0, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiEthernetGroupBox, 1, 0, 1, 2)
|
||||
self.uiATMGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.uiATMGroupBox = QtWidgets.QGroupBox(atmBridgeConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiATMGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiATMGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiATMGroupBox.setObjectName(_fromUtf8("uiATMGroupBox"))
|
||||
self.gridlayout1 = QtGui.QGridLayout(self.uiATMGroupBox)
|
||||
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
|
||||
self.uiATMPortLabel = QtGui.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMPortLabel.setObjectName(_fromUtf8("uiATMPortLabel"))
|
||||
self.uiATMGroupBox.setObjectName("uiATMGroupBox")
|
||||
self.gridlayout1 = QtWidgets.QGridLayout(self.uiATMGroupBox)
|
||||
self.gridlayout1.setObjectName("gridlayout1")
|
||||
self.uiATMPortLabel = QtWidgets.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMPortLabel.setObjectName("uiATMPortLabel")
|
||||
self.gridlayout1.addWidget(self.uiATMPortLabel, 0, 0, 1, 1)
|
||||
self.uiATMPortSpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiATMPortSpinBox = QtWidgets.QSpinBox(self.uiATMGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiATMPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -88,14 +74,14 @@ class Ui_atmBridgeConfigPageWidget(object):
|
||||
self.uiATMPortSpinBox.setMinimum(0)
|
||||
self.uiATMPortSpinBox.setMaximum(65535)
|
||||
self.uiATMPortSpinBox.setProperty("value", 10)
|
||||
self.uiATMPortSpinBox.setObjectName(_fromUtf8("uiATMPortSpinBox"))
|
||||
self.uiATMPortSpinBox.setObjectName("uiATMPortSpinBox")
|
||||
self.gridlayout1.addWidget(self.uiATMPortSpinBox, 0, 1, 1, 1)
|
||||
self.uiATMVPILabel = QtGui.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMVPILabel.setObjectName(_fromUtf8("uiATMVPILabel"))
|
||||
self.uiATMVPILabel = QtWidgets.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMVPILabel.setObjectName("uiATMVPILabel")
|
||||
self.gridlayout1.addWidget(self.uiATMVPILabel, 1, 0, 1, 1)
|
||||
self.uiATMVPISpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
|
||||
self.uiATMVPISpinBox = QtWidgets.QSpinBox(self.uiATMGroupBox)
|
||||
self.uiATMVPISpinBox.setEnabled(True)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiATMVPISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -104,40 +90,40 @@ class Ui_atmBridgeConfigPageWidget(object):
|
||||
self.uiATMVPISpinBox.setMaximum(65535)
|
||||
self.uiATMVPISpinBox.setSingleStep(1)
|
||||
self.uiATMVPISpinBox.setProperty("value", 0)
|
||||
self.uiATMVPISpinBox.setObjectName(_fromUtf8("uiATMVPISpinBox"))
|
||||
self.uiATMVPISpinBox.setObjectName("uiATMVPISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiATMVPISpinBox, 1, 1, 1, 1)
|
||||
self.uiATMVCILabel = QtGui.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMVCILabel.setObjectName(_fromUtf8("uiATMVCILabel"))
|
||||
self.uiATMVCILabel = QtWidgets.QLabel(self.uiATMGroupBox)
|
||||
self.uiATMVCILabel.setObjectName("uiATMVCILabel")
|
||||
self.gridlayout1.addWidget(self.uiATMVCILabel, 2, 0, 1, 1)
|
||||
self.uiATMVCISpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiATMVCISpinBox = QtWidgets.QSpinBox(self.uiATMGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiATMVCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiATMVCISpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiATMVCISpinBox.setMaximum(65535)
|
||||
self.uiATMVCISpinBox.setProperty("value", 100)
|
||||
self.uiATMVCISpinBox.setObjectName(_fromUtf8("uiATMVCISpinBox"))
|
||||
self.uiATMVCISpinBox.setObjectName("uiATMVCISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiATMVCISpinBox, 2, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiATMGroupBox, 2, 0, 1, 2)
|
||||
self.uiAddPushButton = QtGui.QPushButton(atmBridgeConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(atmBridgeConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddPushButton, 3, 0, 1, 1)
|
||||
self.uiDeletePushButton = QtGui.QPushButton(atmBridgeConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(atmBridgeConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeletePushButton, 3, 1, 1, 1)
|
||||
spacerItem = QtGui.QSpacerItem(371, 121, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(371, 121, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 4, 0, 1, 3)
|
||||
self.uiGeneralGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName(_fromUtf8("uiGeneralGroupBox"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.uiNameLabel = QtGui.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName(_fromUtf8("uiNameLabel"))
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(atmBridgeConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtGui.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName(_fromUtf8("uiNameLineEdit"))
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 2)
|
||||
|
||||
@@ -150,18 +136,19 @@ class Ui_atmBridgeConfigPageWidget(object):
|
||||
atmBridgeConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
|
||||
|
||||
def retranslateUi(self, atmBridgeConfigPageWidget):
|
||||
atmBridgeConfigPageWidget.setWindowTitle(_translate("atmBridgeConfigPageWidget", "ATM Bridge", None))
|
||||
self.uiMappingGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Mapping", None))
|
||||
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmBridgeConfigPageWidget", "Ethernet Port", None))
|
||||
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmBridgeConfigPageWidget", "Port:VPI:VCI", None))
|
||||
self.uiEthernetGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Ethernet side", None))
|
||||
self.uiEthernetPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:", None))
|
||||
self.uiATMGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "ATM side", None))
|
||||
self.uiATMPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:", None))
|
||||
self.uiATMVPILabel.setText(_translate("atmBridgeConfigPageWidget", "VPI:", None))
|
||||
self.uiATMVCILabel.setText(_translate("atmBridgeConfigPageWidget", "VCI:", None))
|
||||
self.uiAddPushButton.setText(_translate("atmBridgeConfigPageWidget", "&Add", None))
|
||||
self.uiDeletePushButton.setText(_translate("atmBridgeConfigPageWidget", "&Delete", None))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "General", None))
|
||||
self.uiNameLabel.setText(_translate("atmBridgeConfigPageWidget", "Name:", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
atmBridgeConfigPageWidget.setWindowTitle(_translate("atmBridgeConfigPageWidget", "ATM Bridge"))
|
||||
self.uiMappingGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Mapping"))
|
||||
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmBridgeConfigPageWidget", "Ethernet Port"))
|
||||
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmBridgeConfigPageWidget", "Port:VPI:VCI"))
|
||||
self.uiEthernetGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Ethernet side"))
|
||||
self.uiEthernetPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:"))
|
||||
self.uiATMGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "ATM side"))
|
||||
self.uiATMPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:"))
|
||||
self.uiATMVPILabel.setText(_translate("atmBridgeConfigPageWidget", "VPI:"))
|
||||
self.uiATMVCILabel.setText(_translate("atmBridgeConfigPageWidget", "VCI:"))
|
||||
self.uiAddPushButton.setText(_translate("atmBridgeConfigPageWidget", "&Add"))
|
||||
self.uiDeletePushButton.setText(_translate("atmBridgeConfigPageWidget", "&Delete"))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "General"))
|
||||
self.uiNameLabel.setText(_translate("atmBridgeConfigPageWidget", "Name:"))
|
||||
|
||||
|
||||
@@ -1,85 +1,71 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/atm_switch_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/dynamips/ui/atm_switch_configuration_page.ui'
|
||||
#
|
||||
# Created: Sun Mar 16 11:16:57 2014
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Wed Jul 15 12:22:32 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_atmSwitchConfigPageWidget(object):
|
||||
def setupUi(self, atmSwitchConfigPageWidget):
|
||||
atmSwitchConfigPageWidget.setObjectName(_fromUtf8("atmSwitchConfigPageWidget"))
|
||||
atmSwitchConfigPageWidget.setObjectName("atmSwitchConfigPageWidget")
|
||||
atmSwitchConfigPageWidget.resize(459, 419)
|
||||
self.gridLayout_2 = QtGui.QGridLayout(atmSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.uiGeneralGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName(_fromUtf8("uiGeneralGroupBox"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.uiNameLabel = QtGui.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName(_fromUtf8("uiNameLabel"))
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(atmSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtGui.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName(_fromUtf8("uiNameLineEdit"))
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiVPICheckBox = QtGui.QCheckBox(self.uiGeneralGroupBox)
|
||||
self.uiVPICheckBox.setObjectName(_fromUtf8("uiVPICheckBox"))
|
||||
self.uiVPICheckBox = QtWidgets.QCheckBox(self.uiGeneralGroupBox)
|
||||
self.uiVPICheckBox.setObjectName("uiVPICheckBox")
|
||||
self.gridLayout.addWidget(self.uiVPICheckBox, 1, 0, 1, 2)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 3)
|
||||
self.uiMappingGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiMappingGroupBox.setObjectName(_fromUtf8("uiMappingGroupBox"))
|
||||
self.vboxlayout = QtGui.QVBoxLayout(self.uiMappingGroupBox)
|
||||
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
|
||||
self.uiMappingTreeWidget = QtGui.QTreeWidget(self.uiMappingGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
self.uiMappingGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiMappingGroupBox.setObjectName("uiMappingGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiMappingGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(self.uiMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiMappingTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiMappingTreeWidget.setRootIsDecorated(False)
|
||||
self.uiMappingTreeWidget.setObjectName(_fromUtf8("uiMappingTreeWidget"))
|
||||
self.uiMappingTreeWidget.setObjectName("uiMappingTreeWidget")
|
||||
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiMappingGroupBox, 0, 3, 3, 1)
|
||||
self.uiAddPushButton = QtGui.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddPushButton, 3, 0, 1, 1)
|
||||
self.uiDeletePushButton = QtGui.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeletePushButton, 3, 1, 1, 1)
|
||||
spacerItem = QtGui.QSpacerItem(213, 31, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(213, 31, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 4, 2, 1, 2)
|
||||
self.uiSourceGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.uiSourceGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiSourceGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiSourceGroupBox.setObjectName(_fromUtf8("uiSourceGroupBox"))
|
||||
self.gridlayout = QtGui.QGridLayout(self.uiSourceGroupBox)
|
||||
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
|
||||
self.uiSourcePortLabel = QtGui.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourcePortLabel.setObjectName(_fromUtf8("uiSourcePortLabel"))
|
||||
self.uiSourceGroupBox.setObjectName("uiSourceGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiSourceGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiSourcePortLabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourcePortLabel.setObjectName("uiSourcePortLabel")
|
||||
self.gridlayout.addWidget(self.uiSourcePortLabel, 0, 0, 1, 1)
|
||||
self.uiSourcePortSpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiSourcePortSpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourcePortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -87,50 +73,50 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiSourcePortSpinBox.setMinimum(0)
|
||||
self.uiSourcePortSpinBox.setMaximum(65535)
|
||||
self.uiSourcePortSpinBox.setProperty("value", 1)
|
||||
self.uiSourcePortSpinBox.setObjectName(_fromUtf8("uiSourcePortSpinBox"))
|
||||
self.uiSourcePortSpinBox.setObjectName("uiSourcePortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourcePortSpinBox, 0, 1, 1, 1)
|
||||
self.uiSourceVPILabel = QtGui.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVPILabel.setObjectName(_fromUtf8("uiSourceVPILabel"))
|
||||
self.uiSourceVPILabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVPILabel.setObjectName("uiSourceVPILabel")
|
||||
self.gridlayout.addWidget(self.uiSourceVPILabel, 1, 0, 1, 1)
|
||||
self.uiSourceVPISpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
|
||||
self.uiSourceVPISpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
self.uiSourceVPISpinBox.setEnabled(True)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceVPISpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiSourceVPISpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiSourceVPISpinBox.setMaximum(65535)
|
||||
self.uiSourceVPISpinBox.setProperty("value", 0)
|
||||
self.uiSourceVPISpinBox.setObjectName(_fromUtf8("uiSourceVPISpinBox"))
|
||||
self.uiSourceVPISpinBox.setObjectName("uiSourceVPISpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourceVPISpinBox, 1, 1, 1, 1)
|
||||
self.uiSourceVCILabel = QtGui.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVCILabel.setObjectName(_fromUtf8("uiSourceVCILabel"))
|
||||
self.uiSourceVCILabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVCILabel.setObjectName("uiSourceVCILabel")
|
||||
self.gridlayout.addWidget(self.uiSourceVCILabel, 2, 0, 1, 1)
|
||||
self.uiSourceVCISpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiSourceVCISpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceVCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiSourceVCISpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiSourceVCISpinBox.setMaximum(65535)
|
||||
self.uiSourceVCISpinBox.setProperty("value", 100)
|
||||
self.uiSourceVCISpinBox.setObjectName(_fromUtf8("uiSourceVCISpinBox"))
|
||||
self.uiSourceVCISpinBox.setObjectName("uiSourceVCISpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourceVCISpinBox, 2, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiSourceGroupBox, 1, 0, 1, 3)
|
||||
self.uiDestinationGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.uiDestinationGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiDestinationGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiDestinationGroupBox.setObjectName(_fromUtf8("uiDestinationGroupBox"))
|
||||
self.gridlayout1 = QtGui.QGridLayout(self.uiDestinationGroupBox)
|
||||
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
|
||||
self.uiDestinationPortLabel = QtGui.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationPortLabel.setObjectName(_fromUtf8("uiDestinationPortLabel"))
|
||||
self.uiDestinationGroupBox.setObjectName("uiDestinationGroupBox")
|
||||
self.gridlayout1 = QtWidgets.QGridLayout(self.uiDestinationGroupBox)
|
||||
self.gridlayout1.setObjectName("gridlayout1")
|
||||
self.uiDestinationPortLabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationPortLabel.setObjectName("uiDestinationPortLabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortLabel, 0, 0, 1, 1)
|
||||
self.uiDestinationPortSpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiDestinationPortSpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -138,34 +124,34 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationPortSpinBox.setMinimum(0)
|
||||
self.uiDestinationPortSpinBox.setMaximum(65535)
|
||||
self.uiDestinationPortSpinBox.setProperty("value", 10)
|
||||
self.uiDestinationPortSpinBox.setObjectName(_fromUtf8("uiDestinationPortSpinBox"))
|
||||
self.uiDestinationPortSpinBox.setObjectName("uiDestinationPortSpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortSpinBox, 0, 1, 1, 1)
|
||||
self.uiDestinationVPILabel = QtGui.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPILabel.setObjectName(_fromUtf8("uiDestinationVPILabel"))
|
||||
self.uiDestinationVPILabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPILabel.setObjectName("uiDestinationVPILabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVPILabel, 1, 0, 1, 1)
|
||||
self.uiDestinationVPISpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPISpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPISpinBox.setEnabled(True)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationVPISpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiDestinationVPISpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiDestinationVPISpinBox.setMaximum(65535)
|
||||
self.uiDestinationVPISpinBox.setProperty("value", 0)
|
||||
self.uiDestinationVPISpinBox.setObjectName(_fromUtf8("uiDestinationVPISpinBox"))
|
||||
self.uiDestinationVPISpinBox.setObjectName("uiDestinationVPISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVPISpinBox, 1, 1, 1, 1)
|
||||
self.uiDestinationVCILabel = QtGui.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVCILabel.setObjectName(_fromUtf8("uiDestinationVCILabel"))
|
||||
self.uiDestinationVCILabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVCILabel.setObjectName("uiDestinationVCILabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVCILabel, 2, 0, 1, 1)
|
||||
self.uiDestinationVCISpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiDestinationVCISpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationVCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiDestinationVCISpinBox.setSizePolicy(sizePolicy)
|
||||
self.uiDestinationVCISpinBox.setMaximum(65535)
|
||||
self.uiDestinationVCISpinBox.setProperty("value", 200)
|
||||
self.uiDestinationVCISpinBox.setObjectName(_fromUtf8("uiDestinationVCISpinBox"))
|
||||
self.uiDestinationVCISpinBox.setObjectName("uiDestinationVCISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVCISpinBox, 2, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiDestinationGroupBox, 2, 0, 1, 3)
|
||||
|
||||
@@ -181,21 +167,22 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
atmSwitchConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
|
||||
|
||||
def retranslateUi(self, atmSwitchConfigPageWidget):
|
||||
atmSwitchConfigPageWidget.setWindowTitle(_translate("atmSwitchConfigPageWidget", "ATM Switch", None))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "General", None))
|
||||
self.uiNameLabel.setText(_translate("atmSwitchConfigPageWidget", "Name:", None))
|
||||
self.uiVPICheckBox.setText(_translate("atmSwitchConfigPageWidget", "Use VPI only (VP tunnel)", None))
|
||||
self.uiMappingGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Mapping", None))
|
||||
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI", None))
|
||||
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI", None))
|
||||
self.uiAddPushButton.setText(_translate("atmSwitchConfigPageWidget", "&Add", None))
|
||||
self.uiDeletePushButton.setText(_translate("atmSwitchConfigPageWidget", "&Delete", None))
|
||||
self.uiSourceGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Source", None))
|
||||
self.uiSourcePortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:", None))
|
||||
self.uiSourceVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:", None))
|
||||
self.uiSourceVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:", None))
|
||||
self.uiDestinationGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Destination", None))
|
||||
self.uiDestinationPortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:", None))
|
||||
self.uiDestinationVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:", None))
|
||||
self.uiDestinationVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
atmSwitchConfigPageWidget.setWindowTitle(_translate("atmSwitchConfigPageWidget", "ATM Switch"))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "General"))
|
||||
self.uiNameLabel.setText(_translate("atmSwitchConfigPageWidget", "Name:"))
|
||||
self.uiVPICheckBox.setText(_translate("atmSwitchConfigPageWidget", "Use VPI only (VP tunnel)"))
|
||||
self.uiMappingGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Mapping"))
|
||||
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI"))
|
||||
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI"))
|
||||
self.uiAddPushButton.setText(_translate("atmSwitchConfigPageWidget", "&Add"))
|
||||
self.uiDeletePushButton.setText(_translate("atmSwitchConfigPageWidget", "&Delete"))
|
||||
self.uiSourceGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Source"))
|
||||
self.uiSourcePortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:"))
|
||||
self.uiSourceVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:"))
|
||||
self.uiSourceVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:"))
|
||||
self.uiDestinationGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Destination"))
|
||||
self.uiDestinationPortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:"))
|
||||
self.uiDestinationVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:"))
|
||||
self.uiDestinationVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:"))
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>430</width>
|
||||
<height>539</height>
|
||||
<width>435</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -23,11 +23,35 @@
|
||||
<attribute name="title">
|
||||
<string>General settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiUseLocalServercheckBox">
|
||||
<property name="text">
|
||||
<string>Use the local server</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiDynamipsPathLabel">
|
||||
<property name="text">
|
||||
<string>Path to Dynamips:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="uiDynamipsPathLineEdit"/>
|
||||
<widget class="QLineEdit" name="uiDynamipsPathLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="uiDynamipsPathToolButton">
|
||||
@@ -41,14 +65,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="uiDynamipsPathLabel">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiAllocateAuxConsolePortsCheckBox">
|
||||
<property name="text">
|
||||
<string>Path to Dynamips:</string>
|
||||
<string>Allocate AUX console ports</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -61,162 +85,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="uiConsolePortRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Console port range for routers</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiConsoleStartPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2001</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiConsolePortRangeLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiConsoleEndPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="uiAuxPortRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Auxiliary console port range for routers</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiAuxStartPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2501</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiAuxPortRangeLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiAuxEndPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="uiServerSettingsTabWidget">
|
||||
<attribute name="title">
|
||||
<string>Server settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="uiUseLocalServercheckBox">
|
||||
<property name="text">
|
||||
<string>Always use the local server</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="uiRemoteServersGroupBox">
|
||||
<property name="title">
|
||||
<string>Remote servers</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="uiRemoteServersTreeWidget">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Host</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="uiAdvancedSettingsTabWidget">
|
||||
@@ -224,174 +92,6 @@
|
||||
<string>Advanced settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="uiHypervisorAllocationGroupBox">
|
||||
<property name="title">
|
||||
<string>Hypervisor allocation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiAllocateHypervisorPerDeviceCheckBox">
|
||||
<property name="text">
|
||||
<string>Allocate a new hypervisor for each device</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiMemoryUsageLimitPerHypervisorLabel">
|
||||
<property name="text">
|
||||
<string>Memory usage limit per hypervisor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiMemoryUsageLimitPerHypervisorSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> MiB</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>128</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>512</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiAllocateHypervisorPerIOSCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allocate a new hypervisor per IOS image</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="uiHypervisorPortRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Dynamips hypervisor port range</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiHypervisorStartPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7200</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiHypervisorPortRangeLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiHypervisorEndPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> TCP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>7700</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="uiUDPPortRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>UDP tunneling port range</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiUDPStartPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> UDP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10001</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="uiUDPPortRangeLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="uiUDPEndPortSpinBox">
|
||||
<property name="suffix">
|
||||
<string notr="true"> UDP</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>147</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="uiMemoryUsageOptimisationGroupBox">
|
||||
<property name="title">
|
||||
@@ -424,22 +124,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiJITSharingSupportCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The JIT sharing feature allows router instances to share JIT blocks, instead of recompiling multiple times in a non-shared way.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable JIT sharing support (unstable)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="uiSparseMemorySupportCheckBox">
|
||||
<property name="toolTip">
|
||||
@@ -470,11 +154,6 @@
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>spacer_2</zorder>
|
||||
<zorder>uiMemoryUsageOptimisationGroupBox</zorder>
|
||||
<zorder>uiHypervisorAllocationGroupBox</zorder>
|
||||
<zorder>uiHypervisorPortRangeGroupBox</zorder>
|
||||
<zorder>uiUDPPortRangeGroupBox</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -493,13 +172,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="uiTestSettingsPushButton">
|
||||
<property name="text">
|
||||
<string>Test settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="uiRestoreDefaultsPushButton">
|
||||
<property name="text">
|
||||
@@ -514,12 +186,8 @@
|
||||
<tabstops>
|
||||
<tabstop>uiDynamipsPathLineEdit</tabstop>
|
||||
<tabstop>uiDynamipsPathToolButton</tabstop>
|
||||
<tabstop>uiAllocateHypervisorPerDeviceCheckBox</tabstop>
|
||||
<tabstop>uiMemoryUsageLimitPerHypervisorSpinBox</tabstop>
|
||||
<tabstop>uiAllocateHypervisorPerIOSCheckBox</tabstop>
|
||||
<tabstop>uiGhostIOSSupportCheckBox</tabstop>
|
||||
<tabstop>uiMmapSupportCheckBox</tabstop>
|
||||
<tabstop>uiJITSharingSupportCheckBox</tabstop>
|
||||
<tabstop>uiSparseMemorySupportCheckBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
||||
@@ -1,226 +1,85 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/dynamips/ui/dynamips_preferences_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/dynamips/ui/dynamips_preferences_page.ui'
|
||||
#
|
||||
# Created: Sun Oct 19 11:35:54 2014
|
||||
# by: PyQt4 UI code generator 4.10.4
|
||||
# Created: Wed Jul 15 12:22:32 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_DynamipsPreferencesPageWidget(object):
|
||||
def setupUi(self, DynamipsPreferencesPageWidget):
|
||||
DynamipsPreferencesPageWidget.setObjectName(_fromUtf8("DynamipsPreferencesPageWidget"))
|
||||
DynamipsPreferencesPageWidget.resize(430, 539)
|
||||
self.vboxlayout = QtGui.QVBoxLayout(DynamipsPreferencesPageWidget)
|
||||
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
|
||||
self.uiTabWidget = QtGui.QTabWidget(DynamipsPreferencesPageWidget)
|
||||
self.uiTabWidget.setObjectName(_fromUtf8("uiTabWidget"))
|
||||
self.uiGeneralSettingsTabWidget = QtGui.QWidget()
|
||||
self.uiGeneralSettingsTabWidget.setObjectName(_fromUtf8("uiGeneralSettingsTabWidget"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.uiGeneralSettingsTabWidget)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
||||
self.uiDynamipsPathLineEdit = QtGui.QLineEdit(self.uiGeneralSettingsTabWidget)
|
||||
self.uiDynamipsPathLineEdit.setObjectName(_fromUtf8("uiDynamipsPathLineEdit"))
|
||||
self.horizontalLayout.addWidget(self.uiDynamipsPathLineEdit)
|
||||
self.uiDynamipsPathToolButton = QtGui.QToolButton(self.uiGeneralSettingsTabWidget)
|
||||
self.uiDynamipsPathToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
|
||||
self.uiDynamipsPathToolButton.setObjectName(_fromUtf8("uiDynamipsPathToolButton"))
|
||||
self.horizontalLayout.addWidget(self.uiDynamipsPathToolButton)
|
||||
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
|
||||
self.uiDynamipsPathLabel = QtGui.QLabel(self.uiGeneralSettingsTabWidget)
|
||||
self.uiDynamipsPathLabel.setObjectName(_fromUtf8("uiDynamipsPathLabel"))
|
||||
self.gridLayout.addWidget(self.uiDynamipsPathLabel, 0, 0, 1, 2)
|
||||
spacerItem = QtGui.QSpacerItem(390, 193, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem, 5, 0, 1, 2)
|
||||
self.uiConsolePortRangeGroupBox = QtGui.QGroupBox(self.uiGeneralSettingsTabWidget)
|
||||
self.uiConsolePortRangeGroupBox.setObjectName(_fromUtf8("uiConsolePortRangeGroupBox"))
|
||||
self.horizontalLayout_5 = QtGui.QHBoxLayout(self.uiConsolePortRangeGroupBox)
|
||||
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
|
||||
self.uiConsoleStartPortSpinBox = QtGui.QSpinBox(self.uiConsolePortRangeGroupBox)
|
||||
self.uiConsoleStartPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiConsoleStartPortSpinBox.setMaximum(65535)
|
||||
self.uiConsoleStartPortSpinBox.setProperty("value", 2001)
|
||||
self.uiConsoleStartPortSpinBox.setObjectName(_fromUtf8("uiConsoleStartPortSpinBox"))
|
||||
self.horizontalLayout_5.addWidget(self.uiConsoleStartPortSpinBox)
|
||||
self.uiConsolePortRangeLabel = QtGui.QLabel(self.uiConsolePortRangeGroupBox)
|
||||
self.uiConsolePortRangeLabel.setObjectName(_fromUtf8("uiConsolePortRangeLabel"))
|
||||
self.horizontalLayout_5.addWidget(self.uiConsolePortRangeLabel)
|
||||
self.uiConsoleEndPortSpinBox = QtGui.QSpinBox(self.uiConsolePortRangeGroupBox)
|
||||
self.uiConsoleEndPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiConsoleEndPortSpinBox.setMaximum(65535)
|
||||
self.uiConsoleEndPortSpinBox.setProperty("value", 2500)
|
||||
self.uiConsoleEndPortSpinBox.setObjectName(_fromUtf8("uiConsoleEndPortSpinBox"))
|
||||
self.horizontalLayout_5.addWidget(self.uiConsoleEndPortSpinBox)
|
||||
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_5.addItem(spacerItem1)
|
||||
self.gridLayout.addWidget(self.uiConsolePortRangeGroupBox, 2, 0, 1, 2)
|
||||
self.uiAuxPortRangeGroupBox = QtGui.QGroupBox(self.uiGeneralSettingsTabWidget)
|
||||
self.uiAuxPortRangeGroupBox.setObjectName(_fromUtf8("uiAuxPortRangeGroupBox"))
|
||||
self.horizontalLayout_6 = QtGui.QHBoxLayout(self.uiAuxPortRangeGroupBox)
|
||||
self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
|
||||
self.uiAuxStartPortSpinBox = QtGui.QSpinBox(self.uiAuxPortRangeGroupBox)
|
||||
self.uiAuxStartPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiAuxStartPortSpinBox.setMaximum(65535)
|
||||
self.uiAuxStartPortSpinBox.setProperty("value", 2501)
|
||||
self.uiAuxStartPortSpinBox.setObjectName(_fromUtf8("uiAuxStartPortSpinBox"))
|
||||
self.horizontalLayout_6.addWidget(self.uiAuxStartPortSpinBox)
|
||||
self.uiAuxPortRangeLabel = QtGui.QLabel(self.uiAuxPortRangeGroupBox)
|
||||
self.uiAuxPortRangeLabel.setObjectName(_fromUtf8("uiAuxPortRangeLabel"))
|
||||
self.horizontalLayout_6.addWidget(self.uiAuxPortRangeLabel)
|
||||
self.uiAuxEndPortSpinBox = QtGui.QSpinBox(self.uiAuxPortRangeGroupBox)
|
||||
self.uiAuxEndPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiAuxEndPortSpinBox.setMaximum(65535)
|
||||
self.uiAuxEndPortSpinBox.setProperty("value", 3000)
|
||||
self.uiAuxEndPortSpinBox.setObjectName(_fromUtf8("uiAuxEndPortSpinBox"))
|
||||
self.horizontalLayout_6.addWidget(self.uiAuxEndPortSpinBox)
|
||||
spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_6.addItem(spacerItem2)
|
||||
self.gridLayout.addWidget(self.uiAuxPortRangeGroupBox, 3, 0, 1, 2)
|
||||
self.uiTabWidget.addTab(self.uiGeneralSettingsTabWidget, _fromUtf8(""))
|
||||
self.uiServerSettingsTabWidget = QtGui.QWidget()
|
||||
self.uiServerSettingsTabWidget.setObjectName(_fromUtf8("uiServerSettingsTabWidget"))
|
||||
self.gridLayout_2 = QtGui.QGridLayout(self.uiServerSettingsTabWidget)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.uiUseLocalServercheckBox = QtGui.QCheckBox(self.uiServerSettingsTabWidget)
|
||||
DynamipsPreferencesPageWidget.setObjectName("DynamipsPreferencesPageWidget")
|
||||
DynamipsPreferencesPageWidget.resize(435, 200)
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(DynamipsPreferencesPageWidget)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(DynamipsPreferencesPageWidget)
|
||||
self.uiTabWidget.setObjectName("uiTabWidget")
|
||||
self.uiGeneralSettingsTabWidget = QtWidgets.QWidget()
|
||||
self.uiGeneralSettingsTabWidget.setObjectName("uiGeneralSettingsTabWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.uiGeneralSettingsTabWidget)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.uiUseLocalServercheckBox = QtWidgets.QCheckBox(self.uiGeneralSettingsTabWidget)
|
||||
self.uiUseLocalServercheckBox.setChecked(True)
|
||||
self.uiUseLocalServercheckBox.setObjectName(_fromUtf8("uiUseLocalServercheckBox"))
|
||||
self.gridLayout_2.addWidget(self.uiUseLocalServercheckBox, 0, 0, 1, 1)
|
||||
self.uiRemoteServersGroupBox = QtGui.QGroupBox(self.uiServerSettingsTabWidget)
|
||||
self.uiRemoteServersGroupBox.setObjectName(_fromUtf8("uiRemoteServersGroupBox"))
|
||||
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.uiRemoteServersGroupBox)
|
||||
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
|
||||
self.uiRemoteServersTreeWidget = QtGui.QTreeWidget(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersTreeWidget.setEnabled(False)
|
||||
self.uiRemoteServersTreeWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
|
||||
self.uiRemoteServersTreeWidget.setObjectName(_fromUtf8("uiRemoteServersTreeWidget"))
|
||||
self.horizontalLayout_3.addWidget(self.uiRemoteServersTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiRemoteServersGroupBox, 1, 0, 1, 1)
|
||||
self.uiTabWidget.addTab(self.uiServerSettingsTabWidget, _fromUtf8(""))
|
||||
self.uiAdvancedSettingsTabWidget = QtGui.QWidget()
|
||||
self.uiAdvancedSettingsTabWidget.setObjectName(_fromUtf8("uiAdvancedSettingsTabWidget"))
|
||||
self.verticalLayout_3 = QtGui.QVBoxLayout(self.uiAdvancedSettingsTabWidget)
|
||||
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
|
||||
self.uiHypervisorAllocationGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
|
||||
self.uiHypervisorAllocationGroupBox.setObjectName(_fromUtf8("uiHypervisorAllocationGroupBox"))
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.uiHypervisorAllocationGroupBox)
|
||||
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox = QtGui.QCheckBox(self.uiHypervisorAllocationGroupBox)
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox.setChecked(True)
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox.setObjectName(_fromUtf8("uiAllocateHypervisorPerDeviceCheckBox"))
|
||||
self.verticalLayout_2.addWidget(self.uiAllocateHypervisorPerDeviceCheckBox)
|
||||
self.uiMemoryUsageLimitPerHypervisorLabel = QtGui.QLabel(self.uiHypervisorAllocationGroupBox)
|
||||
self.uiMemoryUsageLimitPerHypervisorLabel.setObjectName(_fromUtf8("uiMemoryUsageLimitPerHypervisorLabel"))
|
||||
self.verticalLayout_2.addWidget(self.uiMemoryUsageLimitPerHypervisorLabel)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox = QtGui.QSpinBox(self.uiHypervisorAllocationGroupBox)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(False)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setMaximum(1000000)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setSingleStep(128)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setProperty("value", 512)
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setObjectName(_fromUtf8("uiMemoryUsageLimitPerHypervisorSpinBox"))
|
||||
self.verticalLayout_2.addWidget(self.uiMemoryUsageLimitPerHypervisorSpinBox)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox = QtGui.QCheckBox(self.uiHypervisorAllocationGroupBox)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(False)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setChecked(True)
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setObjectName(_fromUtf8("uiAllocateHypervisorPerIOSCheckBox"))
|
||||
self.verticalLayout_2.addWidget(self.uiAllocateHypervisorPerIOSCheckBox)
|
||||
self.verticalLayout_3.addWidget(self.uiHypervisorAllocationGroupBox)
|
||||
self.uiHypervisorPortRangeGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
|
||||
self.uiHypervisorPortRangeGroupBox.setObjectName(_fromUtf8("uiHypervisorPortRangeGroupBox"))
|
||||
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.uiHypervisorPortRangeGroupBox)
|
||||
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
|
||||
self.uiHypervisorStartPortSpinBox = QtGui.QSpinBox(self.uiHypervisorPortRangeGroupBox)
|
||||
self.uiHypervisorStartPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiHypervisorStartPortSpinBox.setMaximum(65535)
|
||||
self.uiHypervisorStartPortSpinBox.setProperty("value", 7200)
|
||||
self.uiHypervisorStartPortSpinBox.setObjectName(_fromUtf8("uiHypervisorStartPortSpinBox"))
|
||||
self.horizontalLayout_4.addWidget(self.uiHypervisorStartPortSpinBox)
|
||||
self.uiHypervisorPortRangeLabel = QtGui.QLabel(self.uiHypervisorPortRangeGroupBox)
|
||||
self.uiHypervisorPortRangeLabel.setObjectName(_fromUtf8("uiHypervisorPortRangeLabel"))
|
||||
self.horizontalLayout_4.addWidget(self.uiHypervisorPortRangeLabel)
|
||||
self.uiHypervisorEndPortSpinBox = QtGui.QSpinBox(self.uiHypervisorPortRangeGroupBox)
|
||||
self.uiHypervisorEndPortSpinBox.setSuffix(_fromUtf8(" TCP"))
|
||||
self.uiHypervisorEndPortSpinBox.setMaximum(65535)
|
||||
self.uiHypervisorEndPortSpinBox.setProperty("value", 7700)
|
||||
self.uiHypervisorEndPortSpinBox.setObjectName(_fromUtf8("uiHypervisorEndPortSpinBox"))
|
||||
self.horizontalLayout_4.addWidget(self.uiHypervisorEndPortSpinBox)
|
||||
spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_4.addItem(spacerItem3)
|
||||
self.verticalLayout_3.addWidget(self.uiHypervisorPortRangeGroupBox)
|
||||
self.uiUDPPortRangeGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
|
||||
self.uiUDPPortRangeGroupBox.setObjectName(_fromUtf8("uiUDPPortRangeGroupBox"))
|
||||
self.horizontalLayout_7 = QtGui.QHBoxLayout(self.uiUDPPortRangeGroupBox)
|
||||
self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
|
||||
self.uiUDPStartPortSpinBox = QtGui.QSpinBox(self.uiUDPPortRangeGroupBox)
|
||||
self.uiUDPStartPortSpinBox.setSuffix(_fromUtf8(" UDP"))
|
||||
self.uiUDPStartPortSpinBox.setMaximum(65535)
|
||||
self.uiUDPStartPortSpinBox.setProperty("value", 10001)
|
||||
self.uiUDPStartPortSpinBox.setObjectName(_fromUtf8("uiUDPStartPortSpinBox"))
|
||||
self.horizontalLayout_7.addWidget(self.uiUDPStartPortSpinBox)
|
||||
self.uiUDPPortRangeLabel = QtGui.QLabel(self.uiUDPPortRangeGroupBox)
|
||||
self.uiUDPPortRangeLabel.setObjectName(_fromUtf8("uiUDPPortRangeLabel"))
|
||||
self.horizontalLayout_7.addWidget(self.uiUDPPortRangeLabel)
|
||||
self.uiUDPEndPortSpinBox = QtGui.QSpinBox(self.uiUDPPortRangeGroupBox)
|
||||
self.uiUDPEndPortSpinBox.setSuffix(_fromUtf8(" UDP"))
|
||||
self.uiUDPEndPortSpinBox.setMaximum(65535)
|
||||
self.uiUDPEndPortSpinBox.setProperty("value", 20000)
|
||||
self.uiUDPEndPortSpinBox.setObjectName(_fromUtf8("uiUDPEndPortSpinBox"))
|
||||
self.horizontalLayout_7.addWidget(self.uiUDPEndPortSpinBox)
|
||||
spacerItem4 = QtGui.QSpacerItem(147, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_7.addItem(spacerItem4)
|
||||
self.verticalLayout_3.addWidget(self.uiUDPPortRangeGroupBox)
|
||||
self.uiMemoryUsageOptimisationGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
|
||||
self.uiMemoryUsageOptimisationGroupBox.setObjectName(_fromUtf8("uiMemoryUsageOptimisationGroupBox"))
|
||||
self.verticalLayout = QtGui.QVBoxLayout(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
|
||||
self.uiGhostIOSSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiUseLocalServercheckBox.setObjectName("uiUseLocalServercheckBox")
|
||||
self.verticalLayout_2.addWidget(self.uiUseLocalServercheckBox)
|
||||
self.uiDynamipsPathLabel = QtWidgets.QLabel(self.uiGeneralSettingsTabWidget)
|
||||
self.uiDynamipsPathLabel.setObjectName("uiDynamipsPathLabel")
|
||||
self.verticalLayout_2.addWidget(self.uiDynamipsPathLabel)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.uiDynamipsPathLineEdit = QtWidgets.QLineEdit(self.uiGeneralSettingsTabWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDynamipsPathLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiDynamipsPathLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiDynamipsPathLineEdit.setObjectName("uiDynamipsPathLineEdit")
|
||||
self.horizontalLayout.addWidget(self.uiDynamipsPathLineEdit)
|
||||
self.uiDynamipsPathToolButton = QtWidgets.QToolButton(self.uiGeneralSettingsTabWidget)
|
||||
self.uiDynamipsPathToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
|
||||
self.uiDynamipsPathToolButton.setObjectName("uiDynamipsPathToolButton")
|
||||
self.horizontalLayout.addWidget(self.uiDynamipsPathToolButton)
|
||||
self.verticalLayout_2.addLayout(self.horizontalLayout)
|
||||
self.uiAllocateAuxConsolePortsCheckBox = QtWidgets.QCheckBox(self.uiGeneralSettingsTabWidget)
|
||||
self.uiAllocateAuxConsolePortsCheckBox.setObjectName("uiAllocateAuxConsolePortsCheckBox")
|
||||
self.verticalLayout_2.addWidget(self.uiAllocateAuxConsolePortsCheckBox)
|
||||
spacerItem = QtWidgets.QSpacerItem(390, 193, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout_2.addItem(spacerItem)
|
||||
self.uiTabWidget.addTab(self.uiGeneralSettingsTabWidget, "")
|
||||
self.uiAdvancedSettingsTabWidget = QtWidgets.QWidget()
|
||||
self.uiAdvancedSettingsTabWidget.setObjectName("uiAdvancedSettingsTabWidget")
|
||||
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.uiAdvancedSettingsTabWidget)
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.uiMemoryUsageOptimisationGroupBox = QtWidgets.QGroupBox(self.uiAdvancedSettingsTabWidget)
|
||||
self.uiMemoryUsageOptimisationGroupBox.setObjectName("uiMemoryUsageOptimisationGroupBox")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiGhostIOSSupportCheckBox = QtWidgets.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiGhostIOSSupportCheckBox.setChecked(True)
|
||||
self.uiGhostIOSSupportCheckBox.setObjectName(_fromUtf8("uiGhostIOSSupportCheckBox"))
|
||||
self.uiGhostIOSSupportCheckBox.setObjectName("uiGhostIOSSupportCheckBox")
|
||||
self.verticalLayout.addWidget(self.uiGhostIOSSupportCheckBox)
|
||||
self.uiMmapSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiMmapSupportCheckBox = QtWidgets.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiMmapSupportCheckBox.setChecked(True)
|
||||
self.uiMmapSupportCheckBox.setObjectName(_fromUtf8("uiMmapSupportCheckBox"))
|
||||
self.uiMmapSupportCheckBox.setObjectName("uiMmapSupportCheckBox")
|
||||
self.verticalLayout.addWidget(self.uiMmapSupportCheckBox)
|
||||
self.uiJITSharingSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiJITSharingSupportCheckBox.setEnabled(True)
|
||||
self.uiJITSharingSupportCheckBox.setChecked(False)
|
||||
self.uiJITSharingSupportCheckBox.setObjectName(_fromUtf8("uiJITSharingSupportCheckBox"))
|
||||
self.verticalLayout.addWidget(self.uiJITSharingSupportCheckBox)
|
||||
self.uiSparseMemorySupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiSparseMemorySupportCheckBox = QtWidgets.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
|
||||
self.uiSparseMemorySupportCheckBox.setChecked(False)
|
||||
self.uiSparseMemorySupportCheckBox.setObjectName(_fromUtf8("uiSparseMemorySupportCheckBox"))
|
||||
self.uiSparseMemorySupportCheckBox.setObjectName("uiSparseMemorySupportCheckBox")
|
||||
self.verticalLayout.addWidget(self.uiSparseMemorySupportCheckBox)
|
||||
self.verticalLayout_3.addWidget(self.uiMemoryUsageOptimisationGroupBox)
|
||||
spacerItem5 = QtGui.QSpacerItem(390, 12, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
self.verticalLayout_3.addItem(spacerItem5)
|
||||
self.uiTabWidget.addTab(self.uiAdvancedSettingsTabWidget, _fromUtf8(""))
|
||||
spacerItem1 = QtWidgets.QSpacerItem(390, 12, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.verticalLayout_3.addItem(spacerItem1)
|
||||
self.uiTabWidget.addTab(self.uiAdvancedSettingsTabWidget, "")
|
||||
self.vboxlayout.addWidget(self.uiTabWidget)
|
||||
self.horizontalLayout_2 = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
|
||||
spacerItem6 = QtGui.QSpacerItem(164, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem6)
|
||||
self.uiTestSettingsPushButton = QtGui.QPushButton(DynamipsPreferencesPageWidget)
|
||||
self.uiTestSettingsPushButton.setObjectName(_fromUtf8("uiTestSettingsPushButton"))
|
||||
self.horizontalLayout_2.addWidget(self.uiTestSettingsPushButton)
|
||||
self.uiRestoreDefaultsPushButton = QtGui.QPushButton(DynamipsPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton.setObjectName(_fromUtf8("uiRestoreDefaultsPushButton"))
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
spacerItem2 = QtWidgets.QSpacerItem(164, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem2)
|
||||
self.uiRestoreDefaultsPushButton = QtWidgets.QPushButton(DynamipsPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton.setObjectName("uiRestoreDefaultsPushButton")
|
||||
self.horizontalLayout_2.addWidget(self.uiRestoreDefaultsPushButton)
|
||||
self.vboxlayout.addLayout(self.horizontalLayout_2)
|
||||
|
||||
@@ -228,47 +87,25 @@ class Ui_DynamipsPreferencesPageWidget(object):
|
||||
self.uiTabWidget.setCurrentIndex(0)
|
||||
QtCore.QMetaObject.connectSlotsByName(DynamipsPreferencesPageWidget)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiDynamipsPathLineEdit, self.uiDynamipsPathToolButton)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiDynamipsPathToolButton, self.uiAllocateHypervisorPerDeviceCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiAllocateHypervisorPerDeviceCheckBox, self.uiMemoryUsageLimitPerHypervisorSpinBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiMemoryUsageLimitPerHypervisorSpinBox, self.uiAllocateHypervisorPerIOSCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiAllocateHypervisorPerIOSCheckBox, self.uiGhostIOSSupportCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiDynamipsPathToolButton, self.uiGhostIOSSupportCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiGhostIOSSupportCheckBox, self.uiMmapSupportCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiMmapSupportCheckBox, self.uiJITSharingSupportCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiJITSharingSupportCheckBox, self.uiSparseMemorySupportCheckBox)
|
||||
DynamipsPreferencesPageWidget.setTabOrder(self.uiMmapSupportCheckBox, self.uiSparseMemorySupportCheckBox)
|
||||
|
||||
def retranslateUi(self, DynamipsPreferencesPageWidget):
|
||||
DynamipsPreferencesPageWidget.setWindowTitle(_translate("DynamipsPreferencesPageWidget", "Dynamips", None))
|
||||
self.uiDynamipsPathToolButton.setText(_translate("DynamipsPreferencesPageWidget", "&Browse...", None))
|
||||
self.uiDynamipsPathLabel.setText(_translate("DynamipsPreferencesPageWidget", "Path to Dynamips:", None))
|
||||
self.uiConsolePortRangeGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Console port range for routers", None))
|
||||
self.uiConsolePortRangeLabel.setText(_translate("DynamipsPreferencesPageWidget", "to", None))
|
||||
self.uiAuxPortRangeGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Auxiliary console port range for routers", None))
|
||||
self.uiAuxPortRangeLabel.setText(_translate("DynamipsPreferencesPageWidget", "to", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiGeneralSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "General settings", None))
|
||||
self.uiUseLocalServercheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Always use the local server", None))
|
||||
self.uiRemoteServersGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Remote servers", None))
|
||||
self.uiRemoteServersTreeWidget.headerItem().setText(0, _translate("DynamipsPreferencesPageWidget", "Host", None))
|
||||
self.uiRemoteServersTreeWidget.headerItem().setText(1, _translate("DynamipsPreferencesPageWidget", "Port", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiServerSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Server settings", None))
|
||||
self.uiHypervisorAllocationGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Hypervisor allocation", None))
|
||||
self.uiAllocateHypervisorPerDeviceCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Allocate a new hypervisor for each device", None))
|
||||
self.uiMemoryUsageLimitPerHypervisorLabel.setText(_translate("DynamipsPreferencesPageWidget", "Memory usage limit per hypervisor:", None))
|
||||
self.uiMemoryUsageLimitPerHypervisorSpinBox.setSuffix(_translate("DynamipsPreferencesPageWidget", " MiB", None))
|
||||
self.uiAllocateHypervisorPerIOSCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Allocate a new hypervisor per IOS image", None))
|
||||
self.uiHypervisorPortRangeGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Dynamips hypervisor port range", None))
|
||||
self.uiHypervisorPortRangeLabel.setText(_translate("DynamipsPreferencesPageWidget", "to", None))
|
||||
self.uiUDPPortRangeGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "UDP tunneling port range", None))
|
||||
self.uiUDPPortRangeLabel.setText(_translate("DynamipsPreferencesPageWidget", "to", None))
|
||||
self.uiMemoryUsageOptimisationGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Memory usage optimisation", None))
|
||||
self.uiGhostIOSSupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The ghost IOS feature is a solution that helps to decrease memory usage by sharing an IOS image between different router instances.", None))
|
||||
self.uiGhostIOSSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable ghost IOS support", None))
|
||||
self.uiMmapSupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The mmap feature tells Dynamips to use disk files instead of real memory for router instances.", None))
|
||||
self.uiMmapSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable mmap support", None))
|
||||
self.uiJITSharingSupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The JIT sharing feature allows router instances to share JIT blocks, instead of recompiling multiple times in a non-shared way.", None))
|
||||
self.uiJITSharingSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable JIT sharing support (unstable)", None))
|
||||
self.uiSparseMemorySupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The sparse memory feature reduces the amount of virtual memory used by router instances.", None))
|
||||
self.uiSparseMemorySupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable sparse memory support", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Advanced settings", None))
|
||||
self.uiTestSettingsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Test settings", None))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Restore defaults", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
DynamipsPreferencesPageWidget.setWindowTitle(_translate("DynamipsPreferencesPageWidget", "Dynamips"))
|
||||
self.uiUseLocalServercheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Use the local server"))
|
||||
self.uiDynamipsPathLabel.setText(_translate("DynamipsPreferencesPageWidget", "Path to Dynamips:"))
|
||||
self.uiDynamipsPathToolButton.setText(_translate("DynamipsPreferencesPageWidget", "&Browse..."))
|
||||
self.uiAllocateAuxConsolePortsCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Allocate AUX console ports"))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiGeneralSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "General settings"))
|
||||
self.uiMemoryUsageOptimisationGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Memory usage optimisation"))
|
||||
self.uiGhostIOSSupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The ghost IOS feature is a solution that helps to decrease memory usage by sharing an IOS image between different router instances."))
|
||||
self.uiGhostIOSSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable ghost IOS support"))
|
||||
self.uiMmapSupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The mmap feature tells Dynamips to use disk files instead of real memory for router instances."))
|
||||
self.uiMmapSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable mmap support"))
|
||||
self.uiSparseMemorySupportCheckBox.setToolTip(_translate("DynamipsPreferencesPageWidget", "The sparse memory feature reduces the amount of virtual memory used by router instances."))
|
||||
self.uiSparseMemorySupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable sparse memory support"))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Advanced settings"))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Restore defaults"))
|
||||
|
||||
|
||||
@@ -1,54 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/ethernet_hub_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/dynamips/ui/ethernet_hub_configuration_page.ui'
|
||||
#
|
||||
# Created: Sun Mar 16 11:16:57 2014
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Wed Jul 15 12:22:32 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_ethernetHubConfigPageWidget(object):
|
||||
def setupUi(self, ethernetHubConfigPageWidget):
|
||||
ethernetHubConfigPageWidget.setObjectName(_fromUtf8("ethernetHubConfigPageWidget"))
|
||||
ethernetHubConfigPageWidget.setObjectName("ethernetHubConfigPageWidget")
|
||||
ethernetHubConfigPageWidget.resize(381, 270)
|
||||
self.gridlayout = QtGui.QGridLayout(ethernetHubConfigPageWidget)
|
||||
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
|
||||
self.uiSettingsGroupBox = QtGui.QGroupBox(ethernetHubConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.gridlayout = QtWidgets.QGridLayout(ethernetHubConfigPageWidget)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiSettingsGroupBox = QtWidgets.QGroupBox(ethernetHubConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSettingsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiSettingsGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiSettingsGroupBox.setObjectName(_fromUtf8("uiSettingsGroupBox"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.uiSettingsGroupBox)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.uiNameLabel = QtGui.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiNameLabel.setObjectName(_fromUtf8("uiNameLabel"))
|
||||
self.uiSettingsGroupBox.setObjectName("uiSettingsGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiSettingsGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtGui.QLineEdit(self.uiSettingsGroupBox)
|
||||
self.uiNameLineEdit.setObjectName(_fromUtf8("uiNameLineEdit"))
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiSettingsGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiPortsLabel = QtGui.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiPortsLabel.setObjectName(_fromUtf8("uiPortsLabel"))
|
||||
self.uiPortsLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiPortsLabel.setObjectName("uiPortsLabel")
|
||||
self.gridLayout.addWidget(self.uiPortsLabel, 1, 0, 1, 1)
|
||||
self.uiPortsSpinBox = QtGui.QSpinBox(self.uiSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(self.uiSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -56,9 +42,9 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
self.uiPortsSpinBox.setMinimum(0)
|
||||
self.uiPortsSpinBox.setMaximum(65535)
|
||||
self.uiPortsSpinBox.setProperty("value", 1)
|
||||
self.uiPortsSpinBox.setObjectName(_fromUtf8("uiPortsSpinBox"))
|
||||
self.uiPortsSpinBox.setObjectName("uiPortsSpinBox")
|
||||
self.gridLayout.addWidget(self.uiPortsSpinBox, 1, 1, 1, 1)
|
||||
spacerItem = QtGui.QSpacerItem(20, 71, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem, 2, 1, 1, 1)
|
||||
self.gridlayout.addWidget(self.uiSettingsGroupBox, 0, 1, 1, 1)
|
||||
|
||||
@@ -66,8 +52,9 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
QtCore.QMetaObject.connectSlotsByName(ethernetHubConfigPageWidget)
|
||||
|
||||
def retranslateUi(self, ethernetHubConfigPageWidget):
|
||||
ethernetHubConfigPageWidget.setWindowTitle(_translate("ethernetHubConfigPageWidget", "Ethernet hub", None))
|
||||
self.uiSettingsGroupBox.setTitle(_translate("ethernetHubConfigPageWidget", "Settings", None))
|
||||
self.uiNameLabel.setText(_translate("ethernetHubConfigPageWidget", "Name:", None))
|
||||
self.uiPortsLabel.setText(_translate("ethernetHubConfigPageWidget", "Number of ports:", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
ethernetHubConfigPageWidget.setWindowTitle(_translate("ethernetHubConfigPageWidget", "Ethernet hub"))
|
||||
self.uiSettingsGroupBox.setTitle(_translate("ethernetHubConfigPageWidget", "Settings"))
|
||||
self.uiNameLabel.setText(_translate("ethernetHubConfigPageWidget", "Name:"))
|
||||
self.uiPortsLabel.setText(_translate("ethernetHubConfigPageWidget", "Number of ports:"))
|
||||
|
||||
|
||||
@@ -1,73 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/dynamips/ui/ethernet_switch_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/Users/noplay/code/gns3/gns3-gui/gns3/modules/dynamips/ui/ethernet_switch_configuration_page.ui'
|
||||
#
|
||||
# Created: Thu Jul 17 16:13:17 2014
|
||||
# by: PyQt4 UI code generator 4.10.4
|
||||
# Created: Wed Jul 15 12:22:32 2015
|
||||
# by: PyQt5 UI code generator 5.4
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
def setupUi(self, ethernetSwitchConfigPageWidget):
|
||||
ethernetSwitchConfigPageWidget.setObjectName(_fromUtf8("ethernetSwitchConfigPageWidget"))
|
||||
ethernetSwitchConfigPageWidget.setObjectName("ethernetSwitchConfigPageWidget")
|
||||
ethernetSwitchConfigPageWidget.resize(397, 315)
|
||||
self.gridLayout_2 = QtGui.QGridLayout(ethernetSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
||||
self.uiGeneralGroupBox = QtGui.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName(_fromUtf8("uiGeneralGroupBox"))
|
||||
self.gridLayout = QtGui.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.uiNameLabel = QtGui.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName(_fromUtf8("uiNameLabel"))
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(ethernetSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtGui.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName(_fromUtf8("uiNameLineEdit"))
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 2)
|
||||
self.uiEthernetSwitchPortsGroupBox = QtGui.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiEthernetSwitchPortsGroupBox.setObjectName(_fromUtf8("uiEthernetSwitchPortsGroupBox"))
|
||||
self.vboxlayout = QtGui.QVBoxLayout(self.uiEthernetSwitchPortsGroupBox)
|
||||
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
|
||||
self.uiPortsTreeWidget = QtGui.QTreeWidget(self.uiEthernetSwitchPortsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||
self.uiEthernetSwitchPortsGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiEthernetSwitchPortsGroupBox.setObjectName("uiEthernetSwitchPortsGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiEthernetSwitchPortsGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiPortsTreeWidget = QtWidgets.QTreeWidget(self.uiEthernetSwitchPortsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiPortsTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiPortsTreeWidget.setRootIsDecorated(False)
|
||||
self.uiPortsTreeWidget.setObjectName(_fromUtf8("uiPortsTreeWidget"))
|
||||
self.uiPortsTreeWidget.setObjectName("uiPortsTreeWidget")
|
||||
self.vboxlayout.addWidget(self.uiPortsTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiEthernetSwitchPortsGroupBox, 0, 2, 3, 1)
|
||||
self.uiEthernetSwitchSettingsGroupBox = QtGui.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
|
||||
self.uiEthernetSwitchSettingsGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetSwitchSettingsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiEthernetSwitchSettingsGroupBox.setSizePolicy(sizePolicy)
|
||||
self.uiEthernetSwitchSettingsGroupBox.setObjectName(_fromUtf8("uiEthernetSwitchSettingsGroupBox"))
|
||||
self.gridlayout = QtGui.QGridLayout(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
|
||||
self.label = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.uiEthernetSwitchSettingsGroupBox.setObjectName("uiEthernetSwitchSettingsGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.label = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label.setObjectName("label")
|
||||
self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.uiPortSpinBox = QtGui.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiPortSpinBox = QtWidgets.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -75,13 +61,13 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiPortSpinBox.setMinimum(1)
|
||||
self.uiPortSpinBox.setMaximum(65535)
|
||||
self.uiPortSpinBox.setProperty("value", 1)
|
||||
self.uiPortSpinBox.setObjectName(_fromUtf8("uiPortSpinBox"))
|
||||
self.uiPortSpinBox.setObjectName("uiPortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiPortSpinBox, 0, 1, 1, 1)
|
||||
self.label_3 = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.label_3 = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridlayout.addWidget(self.label_3, 1, 0, 1, 1)
|
||||
self.uiVlanSpinBox = QtGui.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
self.uiVlanSpinBox = QtWidgets.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiVlanSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -89,28 +75,28 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiVlanSpinBox.setMinimum(1)
|
||||
self.uiVlanSpinBox.setMaximum(65535)
|
||||
self.uiVlanSpinBox.setProperty("value", 1)
|
||||
self.uiVlanSpinBox.setObjectName(_fromUtf8("uiVlanSpinBox"))
|
||||
self.uiVlanSpinBox.setObjectName("uiVlanSpinBox")
|
||||
self.gridlayout.addWidget(self.uiVlanSpinBox, 1, 1, 1, 1)
|
||||
self.label_2 = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.label_2 = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridlayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||
self.uiPortTypeComboBox = QtGui.QComboBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortTypeComboBox.setObjectName(_fromUtf8("uiPortTypeComboBox"))
|
||||
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
|
||||
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
|
||||
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
|
||||
self.uiPortTypeComboBox = QtWidgets.QComboBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortTypeComboBox.setObjectName("uiPortTypeComboBox")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.gridlayout.addWidget(self.uiPortTypeComboBox, 2, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiEthernetSwitchSettingsGroupBox, 1, 0, 1, 2)
|
||||
self.uiAddPushButton = QtGui.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddPushButton, 2, 0, 1, 1)
|
||||
self.uiDeletePushButton = QtGui.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeletePushButton, 2, 1, 1, 1)
|
||||
spacerItem = QtGui.QSpacerItem(20, 71, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 3, 1, 1, 1)
|
||||
spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem1, 3, 2, 1, 1)
|
||||
|
||||
self.retranslateUi(ethernetSwitchConfigPageWidget)
|
||||
@@ -122,20 +108,21 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
ethernetSwitchConfigPageWidget.setTabOrder(self.uiDeletePushButton, self.uiPortsTreeWidget)
|
||||
|
||||
def retranslateUi(self, ethernetSwitchConfigPageWidget):
|
||||
ethernetSwitchConfigPageWidget.setWindowTitle(_translate("ethernetSwitchConfigPageWidget", "Ethernet switch configuration", None))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "General", None))
|
||||
self.uiNameLabel.setText(_translate("ethernetSwitchConfigPageWidget", "Name:", None))
|
||||
self.uiEthernetSwitchPortsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Ports", None))
|
||||
self.uiPortsTreeWidget.headerItem().setText(0, _translate("ethernetSwitchConfigPageWidget", "Port", None))
|
||||
self.uiPortsTreeWidget.headerItem().setText(1, _translate("ethernetSwitchConfigPageWidget", "VLAN", None))
|
||||
self.uiPortsTreeWidget.headerItem().setText(2, _translate("ethernetSwitchConfigPageWidget", "Type", None))
|
||||
self.uiEthernetSwitchSettingsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Settings", None))
|
||||
self.label.setText(_translate("ethernetSwitchConfigPageWidget", "Port:", None))
|
||||
self.label_3.setText(_translate("ethernetSwitchConfigPageWidget", "VLAN:", None))
|
||||
self.label_2.setText(_translate("ethernetSwitchConfigPageWidget", "Type:", None))
|
||||
self.uiPortTypeComboBox.setItemText(0, _translate("ethernetSwitchConfigPageWidget", "access", None))
|
||||
self.uiPortTypeComboBox.setItemText(1, _translate("ethernetSwitchConfigPageWidget", "dot1q", None))
|
||||
self.uiPortTypeComboBox.setItemText(2, _translate("ethernetSwitchConfigPageWidget", "qinq", None))
|
||||
self.uiAddPushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Add", None))
|
||||
self.uiDeletePushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Delete", None))
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
ethernetSwitchConfigPageWidget.setWindowTitle(_translate("ethernetSwitchConfigPageWidget", "Ethernet switch configuration"))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "General"))
|
||||
self.uiNameLabel.setText(_translate("ethernetSwitchConfigPageWidget", "Name:"))
|
||||
self.uiEthernetSwitchPortsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Ports"))
|
||||
self.uiPortsTreeWidget.headerItem().setText(0, _translate("ethernetSwitchConfigPageWidget", "Port"))
|
||||
self.uiPortsTreeWidget.headerItem().setText(1, _translate("ethernetSwitchConfigPageWidget", "VLAN"))
|
||||
self.uiPortsTreeWidget.headerItem().setText(2, _translate("ethernetSwitchConfigPageWidget", "Type"))
|
||||
self.uiEthernetSwitchSettingsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Settings"))
|
||||
self.label.setText(_translate("ethernetSwitchConfigPageWidget", "Port:"))
|
||||
self.label_3.setText(_translate("ethernetSwitchConfigPageWidget", "VLAN:"))
|
||||
self.label_2.setText(_translate("ethernetSwitchConfigPageWidget", "Type:"))
|
||||
self.uiPortTypeComboBox.setItemText(0, _translate("ethernetSwitchConfigPageWidget", "access"))
|
||||
self.uiPortTypeComboBox.setItemText(1, _translate("ethernetSwitchConfigPageWidget", "dot1q"))
|
||||
self.uiPortTypeComboBox.setItemText(2, _translate("ethernetSwitchConfigPageWidget", "qinq"))
|
||||
self.uiAddPushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Add"))
|
||||
self.uiDeletePushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Delete"))
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user