From 32e6b5c23f79482c334b56649f5cfdc196d661ba Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:18:45 +0200 Subject: [PATCH 01/14] Test jenkins ovm3 failure --- plugins/hypervisors/ovm3/pom.xml | 17 +++++++++++------ .../ovm3/objects/XmlTestResultTest.java | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 546e7e7423b5..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -27,12 +27,17 @@ ../../pom.xml - - org.apache.xmlrpc - xmlrpc-client - 3.1.3 - - + + org.apache.xmlrpc + xmlrpc-client + 3.1.3 + + + org.apache.commons + commons-lang3 + 3.4 + + ${basedir}/src/main/java ${basedir}/src/main/scripts diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java index 6e44a2b5bfa3..b175a164baa1 100644 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java +++ b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java @@ -22,7 +22,7 @@ import java.util.List; -import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang3.StringEscapeUtils; public class XmlTestResultTest { private static final String NULL = ""; @@ -33,7 +33,7 @@ private String brack(String type, String s) { public String escapeOrNot(String s) { if (s.startsWith("<")) { - return StringEscapeUtils.escapeXml(s); + return StringEscapeUtils.escapeXml10(s); } return s; } From ddad19e1b25a3e325b52e3872d3a6ccc5b349fd6 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:29:32 +0200 Subject: [PATCH 02/14] First test didn't hit problem node, retry --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index df2b5a6f689e..8dc57c01ffed 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 3edd6583b2cd437506c5beed3900bfadb59deaf3 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:32:28 +0200 Subject: [PATCH 03/14] Not a problem node, retry again --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 8dc57c01ffed..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 08eac464ee2cdb019dbe95a15ca0d4ff47429e22 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:34:11 +0200 Subject: [PATCH 04/14] It only hits problem nodes when we don't need it... retry --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index df2b5a6f689e..8dc57c01ffed 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From dbf4dc88c2de59601562ddb446041900e0f05069 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:36:18 +0200 Subject: [PATCH 05/14] Hit a problem node plz mr jenkins.. --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 8dc57c01ffed..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 47fc764693905abdf8c54c8eab5ba29261cc8f3a Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:51:02 +0200 Subject: [PATCH 06/14] Try to pinpoint problem class file --- .../ovm3/objects/CloudStackPluginTest.java | 322 ---- .../hypervisor/ovm3/objects/CommonTest.java | 53 - .../ovm3/objects/ConnectionTest.java | 163 -- .../hypervisor/ovm3/objects/LinuxTest.java | 642 ------- .../hypervisor/ovm3/objects/NetworkTest.java | 345 ---- .../hypervisor/ovm3/objects/NtpTest.java | 97 -- .../ovm3/objects/PoolOCFS2Test.java | 110 -- .../hypervisor/ovm3/objects/PoolTest.java | 180 -- .../hypervisor/ovm3/objects/RemoteTest.java | 36 - .../ovm3/objects/RepositoryTest.java | 182 -- .../ovm3/objects/StoragePluginTest.java | 356 ---- .../hypervisor/ovm3/objects/XenTest.java | 1490 ----------------- .../ovm3/objects/XmlTestResultTest.java | 134 -- .../ovm3/support/Ovm3SupportTest.java | 112 -- 14 files changed, 4222 deletions(-) delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CloudStackPluginTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CommonTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/ConnectionTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/LinuxTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NetworkTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NtpTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolOCFS2Test.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RemoteTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RepositoryTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/StoragePluginTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java delete mode 100644 plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/support/Ovm3SupportTest.java diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CloudStackPluginTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CloudStackPluginTest.java deleted file mode 100644 index a6af6df669cf..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CloudStackPluginTest.java +++ /dev/null @@ -1,322 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - -import org.junit.Test; - -import com.cloud.hypervisor.ovm3.objects.CloudstackPlugin.ReturnCode; - -public class CloudStackPluginTest { - private static final String VMNAME = "test"; - String domrIp = "169.254.3.2"; - public String getDomrIp() { - return domrIp; - } - - public String getDom0Ip() { - return dom0Ip; - } - - public Integer getDomrPort() { - return domrPort; - } - - String dom0Ip = "192.168.1.64"; - Integer domrPort = 3922; - String host = "ovm-1"; - String path = "/tmp"; - String dirpath = "/tmp/testing"; - String filename = "test.txt"; - String content = "This is some content"; - String bridge = "xenbr0"; - String vncPort = "5900"; - Integer port = 8899; - Integer retries = 1; - Integer interval = 1; - Integer timeout = 120; - - ConnectionTest con = new ConnectionTest(); - CloudstackPlugin cSp = new CloudstackPlugin(con); - XmlTestResultTest results = new XmlTestResultTest(); - - String domrExecXml = "" - + "" - + "" - + "" - + "" - + "" - + "out" - + "clearUsageRules.sh func.sh hv-kvp-daemon_3.1_amd64.deb monitorServices.py reconfigLB.sh redundant_router" - + "" - + "" - + "err" - + "" - + "" - + "" - + "rc" - + "0" - + "" - + "" - + "" - + "" - + ""; - String dom0StatsXml = "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "\n" + - "rx\n" + - "11631523\n" + - "\n" + - "\n" + - "\n" + - "total\n" + - "4293918720\n" + - "\n" + - "\n" + - "tx\n" + - "16927399\n" + - "\n" + - "\n" + - "\n" + - "cpu\n" + - "1.5\n" + - "\n" + - "\n" + - "free\n" + - "3162505216\n" + - "\n" + - "\n" + - "\n" + - "\n" + - ""; - String domuStatsXml = "" - + "" - + "" - + "" - + "" - + "" - + "uptime" - + "862195495455" - + "" - + "" - + "rx_bytes" - + "52654010" - + "" - + "" - + "wr_ops" - + "521674" - + "" - + "" - + "vcpus" - + "1" - + "" - + "" - + "cputime" - + "295303661496" - + "" - + "" - + "rd_ops" - + "14790" - + "" - + "" - + "rd_bytes" - + "250168320" - + "" - + "" - + "tx_bytes" - + "161389183" - + "" - + "" - + "wr_bytes" - + "1604468736" - + "" - + "" - + "" - + "" - + ""; - private String dom0StorageCheckXml = "" - + "" - + "" - + "" - + "" - + "1" - + "0" - + "" - + "" - + "" - + ""; - public String getDom0StorageCheckXml() { - return dom0StorageCheckXml; - } - public String getDomrExecXml() { - return domrExecXml; - } - - public String getDom0StatsXml() { - return dom0StatsXml; - } - - public String getDomuStatsXml() { - return domuStatsXml; - } - - @Test - public void testDom0CheckStorageHealthCheck() throws Ovm3ResourceException { - con.setResult(dom0StorageCheckXml); - results.basicBooleanTest(cSp.dom0CheckStorageHealthCheck("", "", "", 120, 1)); - results.basicBooleanTest(cSp.dom0CheckStorageHealthCheck(), false); - } - @Test - public void testOvsUploadFile() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsUploadFile(path, filename, content)); - } - - @Test - public void testOvsUploadSshKey() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsUploadSshKey(path, content)); - } - - @Test - public void testOvsDomrUploadFile() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsDomrUploadFile(VMNAME, path, filename, content)); - } - - @Test - public void testGetVncPort() throws Ovm3ResourceException { - con.setResult(results.getString(vncPort)); - results.basicStringTest(cSp.getVncPort(VMNAME), vncPort); - } - - @Test - public void testDom0CheckPort() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.dom0CheckPort(host, port, retries, interval)); - /* test nothing */ - con.setNull(); - results.basicBooleanTest( - cSp.dom0CheckPort(host, port, retries, interval), false); - /* for the last test we need to fake the timeout... */ - } - - @Test - public void testDom0Ip() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.dom0HasIp(dom0Ip)); - con.setResult(results.getBoolean(false)); - results.basicBooleanTest(cSp.dom0HasIp(dom0Ip), false); - } - - @Test - public void testDomrExec() throws Ovm3ResourceException { - con.setResult(domrExecXml); - ReturnCode x = cSp.domrExec(domrIp, "ls"); - assertNotNull(x); - assertEquals(x.getExit(), (Integer) 0); - assertEquals(x.getRc(), true); - assertEquals(x.getExit(), (Integer) 0); - assertNotNull(x.getStdOut()); - - /* failed */ - domrExecXml = domrExecXml.replace("0", "1"); - domrExecXml = domrExecXml.replace("", "Something went wrong!"); - con.setResult(domrExecXml); - ReturnCode y = cSp.domrExec(domrIp, "ls"); - assertNotNull(y); - assertEquals(y.getRc(), false); - assertEquals(y.getExit(), (Integer) 1); - assertNotNull(x.getStdErr()); - } - - @Test - public void testOvsDom0Stats() throws Ovm3ResourceException { - con.setResult(dom0StatsXml); - Map stats = cSp.ovsDom0Stats(bridge); - results.basicStringTest(stats.get("cpu"), "1.5"); - } - - @Test - public void TestOvsDomUStats() throws Ovm3ResourceException { - con.setResult(domuStatsXml); - Map stats = cSp.ovsDomUStats(VMNAME); - results.basicStringTest(stats.get("cputime"), "295303661496"); - } - - @Test - public void TestDomrCheckPort() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.domrCheckPort(domrIp, domrPort)); - } - - @Test - public void TestDomrCheckSsh() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.domrCheckSsh(domrIp)); - } - - @Test - public void TestOvsControlInterface() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsControlInterface("control0", "169.254.0.1/16")); - } - - @Test - public void TestPing() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ping(host)); - } - - @Test - public void TestOvsCheckFile() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsCheckFile(filename)); - } - - @Test - public void dom0CheckStorageHealth() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.dom0CheckStorageHealth("", "", "", 120)); - con.setResult(results.getBoolean(false)); - results.basicBooleanTest(cSp.dom0CheckStorageHealth("", "", "", 120), false); - } - @Test - public void TestovsMkdirs() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(cSp.ovsMkdirs(dirpath)); - } - @Test - public void TestovsMkdirsDirExists() throws Ovm3ResourceException { - con.setResult(results.getBoolean(true)); - results.basicBooleanTest(cSp.ovsMkdirs(dirpath), false); - } - @Test - public void TestovsMkdirs2() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(cSp.ovsMkdirs(dirpath, 755)); - } - -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CommonTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CommonTest.java deleted file mode 100644 index 114ae262587f..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/CommonTest.java +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import org.junit.Test; - -public class CommonTest { - ConnectionTest con = new ConnectionTest(); - Common cOm = new Common(con); - XmlTestResultTest results = new XmlTestResultTest(); - String echo = "put"; - String remoteUrl = "http://oracle:password@ovm-2:8899"; - - @Test - public void testGetApiVersion() throws Ovm3ResourceException { - con.setResult(results - .simpleResponseWrap("\n3\n")); - results.basicIntTest(cOm.getApiVersion(), 3); - } - - @Test - public void testSleep() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(cOm.sleep(1)); - } - - @Test - public void testDispatch() throws Ovm3ResourceException { - con.setResult(results.getString(echo)); - results.basicStringTest(cOm.dispatch(remoteUrl, "echo", echo), echo); - } - - @Test - public void testEcho() throws Ovm3ResourceException { - con.setResult(results.getString(echo)); - results.basicStringTest(cOm.echo(echo), echo); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/ConnectionTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/ConnectionTest.java deleted file mode 100644 index e7a94c9113ae..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/ConnectionTest.java +++ /dev/null @@ -1,163 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.client.XmlRpcClient; -import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl; -import org.apache.xmlrpc.common.XmlRpcStreamConfig; -import org.apache.xmlrpc.common.XmlRpcStreamRequestConfig; -import org.apache.xmlrpc.parser.XmlRpcResponseParser; -import org.apache.xmlrpc.util.SAXParsers; -import org.junit.Test; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -/* - * This is a stub for XML parsing into result sets, it also contains test for - * Connection - */ -public class ConnectionTest extends Connection { - private final Logger LOGGER = Logger.getLogger(ConnectionTest.class); - XmlTestResultTest results = new XmlTestResultTest(); - String result; - List multiRes = new ArrayList(); - String hostIp; - private Map methodResponse = new HashMap(); - - public ConnectionTest() { - } - - @Override - public Object callTimeoutInSec(String method, List params, int timeout, - boolean debug) throws XmlRpcException { - XmlRpcStreamConfig config = new XmlRpcHttpRequestConfigImpl(); - XmlRpcClient client = new XmlRpcClient(); - client.setTypeFactory(new RpcTypeFactory(client)); - XmlRpcResponseParser parser = new XmlRpcResponseParser( - (XmlRpcStreamRequestConfig) config, client.getTypeFactory()); - XMLReader xr = SAXParsers.newXMLReader(); - xr.setContentHandler(parser); - try { - String result = null; - if (getMethodResponse(method) != null) { - result = getMethodResponse(method); - LOGGER.debug("methodresponse call: " + method + " - " + params); - LOGGER.trace("methodresponse reply: " + result); - } - if (result == null && multiRes.size() >= 0) { - result = getResult(); - LOGGER.debug("getresult call: " + method + " - " + params); - LOGGER.trace("getresult reply: " + result); - } - xr.parse(new InputSource(new StringReader(result))); - } catch (Exception e) { - throw new XmlRpcException("Exception: " + e.getMessage(), e); - } - if (parser.getErrorCode() != 0) { - throw new XmlRpcException("Fault received[" + parser.getErrorCode() - + "]: " + parser.getErrorMessage()); - } - return parser.getResult(); - } - - public void setMethodResponse(String method, String response) { - methodResponse.put(method, response); - } - - public String getMethodResponse(String method) { - if (methodResponse.containsKey(method)) { - return methodResponse.get(method); - } - return null; - } - - public void removeMethodResponse(String method) { - if (methodResponse.containsKey(method)) { - methodResponse.remove(method); - } - } - - public void setResult(String res) { - multiRes = new ArrayList(); - multiRes.add(0, res); - } - - public void setResult(List l) { - multiRes = new ArrayList(); - multiRes.addAll(l); - } - - public void setNull() { - multiRes = new ArrayList(); - multiRes.add(0, null); - } - - /* result chainsing */ - public void addResult(String e) { - multiRes.add(e); - } - - public void addNull() { - multiRes.add(null); - } - - public String getResult() { - return popResult(); - } - - public String popResult() { - String res = multiRes.get(0); - if (multiRes.size() > 1) - multiRes.remove(0); - return res; - } - - public List resultList() { - return multiRes; - } - - @Test - public void testConnection() { - String host = "ovm-1"; - String user = "admin"; - String pass = "password"; - Integer port = 8899; - List emptyParams = new ArrayList(); - Connection con = new Connection(host, port, user, pass); - results.basicStringTest(con.getIp(), host); - results.basicStringTest(con.getUserName(), user); - results.basicStringTest(con.getPassword(), pass); - results.basicIntTest(con.getPort(), port); - try { - con.callTimeoutInSec("ping", emptyParams, 1); - // con.call("ping", emptyParams, 1, false); - } catch (XmlRpcException e) { - // TODO Auto-generated catch block - System.out.println("Exception: " + e); - } - new Connection(host, user, pass); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/LinuxTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/LinuxTest.java deleted file mode 100644 index 9eb60fe131b2..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/LinuxTest.java +++ /dev/null @@ -1,642 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import org.junit.Test; - -public class LinuxTest { - public LinuxTest() { - } - ConnectionTest con = new ConnectionTest(); - Linux lin = new Linux(con); - XmlTestResultTest results = new XmlTestResultTest(); - - private final String DISCOVERSERVER = "<?xml version=\"1.0\" ?>" - + "<Discover_Server_Result>" - + "<Server>" - + "<Unique_Id>1d:d5:e8:91:d9:d0:ed:bd:81:c2:a6:9a:b3:d1:b7:ea</Unique_Id>" - + "<Boot_Time>1413834408</Boot_Time>" - + "<Date_Time>" - + "<Time_Zone>Europe/Amsterdam</Time_Zone>" - + "<UTC>True</UTC>" - + "</Date_Time>" - + "<NTP>" - + "<Local_Time_Source>True</Local_Time_Source>" - + "<Is_NTP_Running>True</Is_NTP_Running>" - + "</NTP>" - + "<Agent_Version>3.2.1-183</Agent_Version>" - + "<RPM_Version>3.2.1-183</RPM_Version>" - + "<OVM_Version>3.2.1-517</OVM_Version>" - + "<CPU_Type>x86_64</CPU_Type>" - + "<OS_Type>Linux</OS_Type>" - + "<OS_Name>Oracle VM Server</OS_Name>" - + "<OS_Major_Version>5</OS_Major_Version>" - + "<OS_Minor_Version>7</OS_Minor_Version>" - + "<Hypervisor_Type>xen</Hypervisor_Type>" - + "<Hypervisor_Name>Xen</Hypervisor_Name>" - + "<Host_Kernel_Release>2.6.39-300.22.2.el5uek</Host_Kernel_Release>" - + "<Host_Kernel_Version>#1 SMP Fri Jan 4 12:40:29 PST 2013</Host_Kernel_Version>" - + "<VMM>" - + "<Version>" - + "<Major>4</Major>" - + "<Minor>1</Minor>" - + "<Extra>.3OVM</Extra>" - + "</Version>" - + "<Compile_Information>" - + "<Compiler>gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)</Compiler>" - + "<By>mockbuild</By>" - + "<Domain>us.oracle.com</Domain>" - + "<Date>Wed Dec 5 09:11:29 PST 2012</Date>" - + "</Compile_Information>" - + "<Capabilities>xen-3.0-x86_64 xen-3.0-x86_32p</Capabilities>" - + "</VMM>" - + "<Pool_Unique_Id>f12842eb-f5ed-3fe7-8da1-eb0e17f5ede8</Pool_Unique_Id>" - + "<Manager_Unique_Id>d1a749d4295041fb99854f52ea4dea97</Manager_Unique_Id>" - + "<Hostname>ovm-1</Hostname>" - + "<Registered_IP>192.168.1.64</Registered_IP>" - + "<Node_Number>1</Node_Number>" - + "<Server_Roles>xen,utility</Server_Roles>" - + "<Is_Current_Master>true</Is_Current_Master>" - + "<Master_Virtual_Ip>192.168.1.230</Master_Virtual_Ip>" - + "<Manager_Core_API_Version>3.2.1.516</Manager_Core_API_Version>" - + "<Membership_State>Pooled</Membership_State>" - + "<Cluster_State>Offline</Cluster_State>" - + "<Statistic>" - + "<Interval>20</Interval>" - + "</Statistic>" - + "<Exports/>" - + "<Capabilities>" - + "<ISCSI>True</ISCSI>" - + "<BOND_MODE_LINK_AGGREGATION>True</BOND_MODE_LINK_AGGREGATION>" - + "<POWER_ON_WOL>True</POWER_ON_WOL>" - + "<ALL_VM_CPU_OVERSUBSCRIBE>True</ALL_VM_CPU_OVERSUBSCRIBE>" - + "<HVM_MAX_VNICS>8</HVM_MAX_VNICS>" - + "<FIBRE_CHANNEL>True</FIBRE_CHANNEL>" - + "<MAX_CONCURRENT_MIGRATION_OUT>1</MAX_CONCURRENT_MIGRATION_OUT>" - + "<LOCAL_STORAGE_ELEMENT>True</LOCAL_STORAGE_ELEMENT>" - + "<CLUSTERS>True</CLUSTERS>" - + "<CONCURRENT_MIGRATION>False</CONCURRENT_MIGRATION>" - + "<VM_MEMORY_ALIGNMENT>1048576</VM_MEMORY_ALIGNMENT>" - + "<MIGRATION_SETUP>False</MIGRATION_SETUP>" - + "<PER_VM_CPU_OVERSUBSCRIBE>True</PER_VM_CPU_OVERSUBSCRIBE>" - + "<BOND_MODE_ACTIVE_BACKUP>True</BOND_MODE_ACTIVE_BACKUP>" - + "<NFS>True</NFS>" - + "<VM_VNC_CONSOLE>True</VM_VNC_CONSOLE>" - + "<MTU_CONFIGURATION>True</MTU_CONFIGURATION>" - + "<HIGH_AVAILABILITY>True</HIGH_AVAILABILITY>" - + "<MAX_CONCURRENT_MIGRATION_IN>1</MAX_CONCURRENT_MIGRATION_IN>" - + "<VM_SERIAL_CONSOLE>True</VM_SERIAL_CONSOLE>" - + "<BOND_MODE_ADAPTIVE_LOAD_BALANCING>True</BOND_MODE_ADAPTIVE_LOAD_BALANCING>" - + "<VM_SUSPEND>True</VM_SUSPEND>" - + "<YUM_PACKAGE_MANAGEMENT>True</YUM_PACKAGE_MANAGEMENT>" - + "</Capabilities>" + "</Server>" - + "</Discover_Server_Result>"; - - public String getDiscoverserver() { - return DISCOVERSERVER; - } - - public String getDiscoverHw() { - return DISCOVERHW; - } - - public String getDiscoverFs() { - return DISCOVERFS; - } - - private final String DISCOVERHW = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" - + "<Discover_Hardware_Result>" - + "<NodeInformation>" - + "<VMM>" - + "<PhysicalInfo>" - + "<ThreadsPerCore>1</ThreadsPerCore>" - + "<CoresPerSocket>1</CoresPerSocket>" - + "<SocketsPerNode>2</SocketsPerNode>" - + "<Nodes>1</Nodes>" - + "<CPUKHz>3392400</CPUKHz>" - + "<TotalPages>1048476</TotalPages>" - + "<FreePages>863459</FreePages>" - + "<HW_Caps>" - + "<Item_0>0x0f8bf3ff</Item_0>" - + "<Item_1>0x28100800</Item_1>" - + "<Item_2>0x00000000</Item_2>" - + "<Item_3>0x00000040</Item_3>" - + "<Item_4>0xb19a2223</Item_4>" - + "<Item_5>0x00000000</Item_5>" - + "<Item_6>0x00000001</Item_6>" - + "<Item_7>0x00000281</Item_7>" - + "</HW_Caps>" - + "</PhysicalInfo>" - + "</VMM>" - + "<CPUInfo>" - + "<Proc_Info>" - + "<CPU ID=\"0\">" - + "<vendor_id>GenuineIntel</vendor_id>" - + "<cpu_family>6</cpu_family>" - + "<model>2</model>" - + "<model_name>Intel Core i7 9xx (Nehalem Class Core i7)</model_name>" - + "<stepping>3</stepping>" - + "<cache_size>4096 KB</cache_size>" - + "<flags>fpu de tsc msr pae mce cx8 apic mca cmov clflush mmx fxsr sse sse2 ss syscall nx lm rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt f16c hypervisor lahf_lm fsgsbase erms</flags>" - + "</CPU>" - + "<CPU ID=\"1\">" - + "<vendor_id>GenuineIntel</vendor_id>" - + "<cpu_family>6</cpu_family>" - + "<model>2</model>" - + "<model_name>Intel Core i7 9xx (Nehalem Class Core i7)</model_name>" - + "<stepping>3</stepping>" - + "<cache_size>4096 KB</cache_size>" - + "<flags>fpu de tsc msr pae mce cx8 apic mca cmov clflush mmx fxsr sse sse2 ss syscall nx lm rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt f16c hypervisor lahf_lm fsgsbase erms</flags>" - + "</CPU>" - + "</Proc_Info>" - + "</CPUInfo>" - + "<IO>" - + "<SCSI>" - + "<SCSI_Host Num=\"0\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>1000c017</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>1</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"1\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>10004016</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>2</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"2\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>10004016</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>3</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"3\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>10004016</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>4</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"4\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>10004016</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>5</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"5\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Ahci_Host_Cap2>0</Ahci_Host_Cap2>" - + "<Ahci_Host_Caps>40141f05</Ahci_Host_Caps>" - + "<Ahci_Host_Version>10000</Ahci_Host_Version>" - + "<Ahci_Port_Cmd>10004016</Ahci_Port_Cmd>" - + "<Can_Queue>31</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Em_Message_Supported></Em_Message_Supported>" - + "<Em_Message_Type>0</Em_Message_Type>" - + "<Host_Busy>0</Host_Busy>" - + "<Link_Power_Management_Policy>max_performance</Link_Power_Management_Policy>" - + "<Proc_Name>ahci</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>168</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>6</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010601</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x2922</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>58</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs>58</Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ahci PCI_CLASS=10601 PCI_ID=8086:2922 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:05.0 MODALIAS=pci:v00008086d00002922sv00001AF4sd00001100bc01sc06i01</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"6\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Can_Queue>1</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Host_Busy>0</Host_Busy>" - + "<Proc_Name>ata_piix</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>128</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>7</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010180</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x7010</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>0</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs></Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ata_piix PCI_CLASS=10180 PCI_ID=8086:7010 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:01.1 MODALIAS=pci:v00008086d00007010sv00001AF4sd00001100bc01sc01i80</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<SCSI_Host Num=\"7\">" - + "<Active_Mode>Initiator</Active_Mode>" - + "<Can_Queue>1</Can_Queue>" - + "<Cmd_Per_Lun>1</Cmd_Per_Lun>" - + "<Host_Busy>0</Host_Busy>" - + "<Proc_Name>ata_piix</Proc_Name>" - + "<Prot_Capabilities>0</Prot_Capabilities>" - + "<Prot_Guard_Type>0</Prot_Guard_Type>" - + "<Sg_Prot_Tablesize>0</Sg_Prot_Tablesize>" - + "<Sg_Tablesize>128</Sg_Tablesize>" - + "<State>running</State>" - + "<Supported_Mode>Initiator</Supported_Mode>" - + "<Uevent></Uevent>" - + "<Unique_Id>8</Unique_Id>" - + "<SysFSDev>" - + "<Broken_Parity_Status>0</Broken_Parity_Status>" - + "<Class>0x010180</Class>" - + "<Consistent_Dma_Mask_Bits>32</Consistent_Dma_Mask_Bits>" - + "<Device>0x7010</Device>" - + "<Dma_Mask_Bits>32</Dma_Mask_Bits>" - + "<Enable>1</Enable>" - + "<Irq>0</Irq>" - + "<Local_Cpulist>0-1</Local_Cpulist>" - + "<Msi_Bus></Msi_Bus>" - + "<Msi_Irqs></Msi_Irqs>" - + "<Numa_Node>-1</Numa_Node>" - + "<Subsystem_Device>0x1100</Subsystem_Device>" - + "<Subsystem_Vendor>0x1af4</Subsystem_Vendor>" - + "<Uevent>DRIVER=ata_piix PCI_CLASS=10180 PCI_ID=8086:7010 PCI_SUBSYS_ID=1AF4:1100 PCI_SLOT_NAME=0000:00:01.1 MODALIAS=pci:v00008086d00007010sv00001AF4sd00001100bc01sc01i80</Uevent>" - + "<Vendor>0x8086</Vendor>" - + "</SysFSDev>" - + "</SCSI_Host>" - + "<ISCSI_Node>" - + "<Initiatorname>iqn.1988-12.com.oracle:3b3f5e2f59cb</Initiatorname>" - + "</ISCSI_Node>" - + "</SCSI>" - + "<IDE>" - + "</IDE>" - + "</IO>" - + "<DMTF>" - + "<SMBIOS Version=\"2.4.0\">" - + "<MaxSize>48</MaxSize>" - + "</SMBIOS>" - + "<DMI Version=\"2.4\">" - + "<TableLength>346</TableLength>" - + "<Items>13</Items>" - + "<Buffer>" - + "ABgAAAECAOgDAAgAAAAAAAAAAAQBAP//Qm9jaHMAQm9jaHMAMDEvMDEvMjAxMQAAARsAAQEC" - + "AAAd1eiR2dDtvYHCppqz0bfqBgAAQm9jaHMAQm9jaHMAAAMUAAMBAQAAAAMDAwIAAAAAAAAA" - + "Qm9jaHMAAAQgAQQBAwECIwYAAP/7iw8AAAAA0AfQB0EB////////Q1BVIDEAQm9jaHMAAAQg" - + "AgQBAwECIwYAAP/7iw8AAAAA0AfQB0EB////////Q1BVIDIAQm9jaHMAABAPABABAwYAAEAA" - + "/v8BAAAAERUAEQAQAwBAAEAAABAJAAEABwAARElNTSAwAAATDwATAAAAAP//NwAAEAEAABMP" - + "ARMAAEAA//9HAAAQAQAAFBMAFAAAAAD//zcAABEAEwEAAAAAFBMBFAAAQAD//0cAABEBEwEA" - + "AAAAIAsAIAAAAAAAAAAAAH8EAH8AAA==" - + "</Buffer>" - + "</DMI>" - + "<BIOS Type=\"0\" Item=\"0\" Handle=\"0x0\">" - + "<Vendor>Bochs</Vendor>" - + "<Version>Bochs</Version>" - + "<ReleaseDate>01/01/2011</ReleaseDate>" - + "</BIOS>" - + "<System Type=\"1\" Item=\"1\" Handle=\"0x100\">" - + "<UUID>1d:d5:e8:91:d9:d0:ed:bd:81:c2:a6:9a:b3:d1:b7:ea</UUID>" - + "<Manufacturer>Bochs</Manufacturer>" - + "<ProductName>Bochs</ProductName>" - + "</System>" - + "<Chassis Type=\"3\" Item=\"2\" Handle=\"0x300\">" - + "<Height>0U</Height>" - + "<Manufacturer>Bochs</Manufacturer>" - + "</Chassis>" - + "</DMTF>" - + "</NodeInformation>" - + "</Discover_Hardware_Result>"; - private final String FSTYPE = "nfs"; - private final String REMOTEHOST = "cs-mgmt"; - private final String REMOTEDIR = "/volumes/cs-data/primary/ovm"; - public String getFsType() { - return FSTYPE; - } - - public String getRemoteHost() { - return REMOTEHOST; - } - - public String getRemoteDir() { - return REMOTEDIR; - } - - public String getRemote() { - return REMOTE; - } - - public String getRepoId() { - return REPOID; - } - - public String getRepoMnt() { - return REPOMNT; - } - public String getVirtualDisksDir() { - return REPOMNT + "/VirtualDisks"; - } - public String getTemplatesDir() { - return REPOMNT + "/Templates"; - } - public String getIsoDir() { - return REPOMNT + "/ISOs"; - } - private final String REMOTE = REMOTEHOST + ":" + REMOTEDIR; - private final String REPOID = "f12842eb-f5ed-3fe7-8da1-eb0e17f5ede8"; - private final String DDREPOID = lin.deDash(REPOID); - private final String REPOMNT = "/OVS/Repositories/" + DDREPOID; - private final String VMMNT = "/nfsmnt/" + REPOID; - private final String DISCOVERFS = "<?xml version=\"1.0\" ?>" - + "<Discover_Mounted_File_Systems_Result>" - + "<Filesystem Type=\"" - + FSTYPE - + "\">" - + "<Mount Dir=\"" - + REPOMNT - + "\">" - + "<Device>" - + REMOTE - + "</Device>" - + "<Mount_Options>rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=65535,timeo=600,retrans=2,sec=sys,local_lock=none,addr=192.168.1.61</Mount_Options>" - + "</Mount>" - + "<Mount Dir=\"" - + VMMNT - + "\">" - + "<Device>" - + REMOTE - + "/VirtualMachines</Device>" - + "<Mount_Options>rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,proto=tcp,port=65535,timeo=600,retrans=2,sec=sys,local_lock=none,addr=192.168.1.61</Mount_Options>" - + "</Mount>" + "</Filesystem>" - + "</Discover_Mounted_File_Systems_Result>"; - private final String LASTBOOT = "" + "" - + "last_boot_time" - + "1413834408" + "" + "" - + "local_time" + "1414082517" - + "" + ""; - private final String TIMEZONE = "" - + "Europe/Amsterdam" - + "1" + ""; - - @Test - public void testDiscoverServer() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(DISCOVERSERVER)); - results.basicStringTest(lin.getMembershipState(), "Pooled"); - lin.discoverServer(); - results.basicStringTest(lin.getCapabilities(), - "xen-3.0-x86_64 xen-3.0-x86_32p"); - results.basicStringTest(lin.getOvmVersion(), "3.2.1-517"); - results.basicStringTest(lin.getHypervisorVersion(), "4.1.3OVM"); - results.basicStringTest(lin.get("MAX_CONCURRENT_MIGRATION_IN"), "1"); - } - - @Test - public void testGetTimeZone() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(TIMEZONE)); - results.basicBooleanTest(lin.getTimeZone()); - } - - @Test - public void testLastBootTime() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(LASTBOOT)); - results.basicIntTest(lin.getLastBootTime(), 1413834408); - } - - @Test - public void testDiscoverHardware() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(DISCOVERHW)); - lin.discoverHardware(); - results.basicDoubleTest(lin.getMemory(), - Double.valueOf("1048476") * 4096); - results.basicDoubleTest(lin.getFreeMemory(), - Double.valueOf("863459") * 4096); - results.basicStringTest(lin.get("UUID"), - "1d:d5:e8:91:d9:d0:ed:bd:81:c2:a6:9a:b3:d1:b7:ea"); - } - - @Test - public void testDiscoverMountedFileSystems() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(DISCOVERFS)); - lin.discoverMountedFs(FSTYPE); - results.basicBooleanTest( - results.basicListHasString(lin.getFileSystemList(), REPOMNT), - true); - results.basicBooleanTest( - results.basicListHasString(lin.getFileSystemList(), VMMNT), - true); - results.basicBooleanTest( - results.basicListHasString(lin.getFileSystemList(), REMOTE), - false); - results.basicStringTest(lin.getFileSystem(VMMNT, FSTYPE) - .getMountPoint(), VMMNT); - results.basicStringTest(lin.getFileSystem(VMMNT, FSTYPE).getHost(), - REMOTEHOST); - results.basicStringTest(lin.getFileSystem(VMMNT, FSTYPE).getUuid(), - REPOID); - results.basicStringTest(lin.getFileSystem(REPOMNT, FSTYPE).getUuid(), - DDREPOID); - results.basicStringTest(lin.getFileSystem(REPOMNT, FSTYPE) - .getRemoteDir(), REMOTEDIR); - results.basicBooleanTest(lin.getFileSystem(VMMNT, FSTYPE).getDetails() - .containsKey("Uuid"), true); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NetworkTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NetworkTest.java deleted file mode 100644 index effc7c51ab01..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NetworkTest.java +++ /dev/null @@ -1,345 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import org.junit.Test; - -public class NetworkTest { - ConnectionTest con = new ConnectionTest(); - Network net = new Network(con); - XmlTestResultTest results = new XmlTestResultTest(); - - private String IP = "192.168.1.64"; - private String BR = "192.168.1.255"; - private String MAC = "52:54:00:24:47:70"; - private String INT = "xenbr0"; - private String PHY = "bond0"; - private String VLANBR = "bond0"; - public String getBroadcast() { - return BR; - } - - public String getMac() { - return MAC; - } - - public String getInterface() { - return INT; - } - - public String getPhysical() { - return PHY; - } - - public String getVlanBridge() { - return VLANBR; - } - - public String getVlanInterface() { - return VLANINT; - } - - public Integer getVlan() { - return VLAN; - } - - public String getControl() { - return CONTROL; - } - - private String VLANINT = "xenbr0"; - private Integer VLAN = 200; - private String CONTROL = "control0"; - private String CONTROLMAC = "B2:D1:75:69:8C:58"; - private String EMPTY = results.escapeOrNot("" - + "" + ""); - private String DISCOVERNETWORK = results - .escapeOrNot("" - + "" + " " - + " " + " " - + " " - + " 52:54:00:24:47:70" - + " (0x1043) IFF_UP IFF_BROADCAST IFF_RUNNING IFF_MULTICAST" - + " " - + " " - + " Incomplete" - + " 100baseT-FD" - + " " - + " ok" - + " " - + " 00:00:00" - + " 0" - + " 0" - + " " - + " autonegotiation complete " - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " " - + " " - + " disabled" - + " " - + " " - + " INTERFACE=" - + PHY - + "IFINDEX=2" - + " 0" - + " 6" - + " 0x0" - + " " - + " 2" - + " 2" - + " 0x200041a0" - + " 1" - + " 0" - + " 1" - + " 100" - + " full" - + " 0" - + " up" - + " 1500" - + " 0x1103" - + " 1000" - + " 0" - + " " - + " 0x10ec" - + " 0x8139" - + " 0x1af4" - + " 0x1100" - + " 0x020000" - + " " - + " " - + " none" - + " ethernet:c0a80100{192.168.1.0}:MANAGEMENT,CLUSTER_HEARTBEAT,LIVE_MIGRATE,VIRTUAL_MACHINE,STORAGE" - + " " - + " " - + " 52:54:00:26:7F:A0" - + " (0x1843) IFF_UP IFF_BROADCAST IFF_RUNNING IFF_SLAVE IFF_MULTICAST" - + " " - + " " - + " Incomplete" - + " 100baseT-FD" - + " " - + " ok" - + " " - + " 00:00:00" - + " 0" - + " 0" - + " " - + " autonegotiation complete " - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " 100baseT-FD 100baseT-HD 10baseT-FD 10baseT-HD" - + " " - + " " - + " disabled" - + " " - + " " - + " INTERFACE=eth1" - + "IFINDEX=3" - + " 0" - + " 6" - + " 0x0" - + " " - + " 3" - + " 3" - + " 0x200041a0" - + " 1" - + " 0" - + " 1" - + " 100" - + " full" - + " 0" - + " up" - + " 1500" - + " 0x1903" - + " 1000" - + " 0" - + " " - + " 0x10ec" - + " 0x8139" - + " 0x1af4" - + " 0x1100" - + " 0x020000" - + " " - + " " - + " none" - + " " - + " " - + " " - + " " - + " active-backup" - + " eth1 (primary_reselect always)" - + " eth1" - + " up" - + " 250" - + " 500" - + " 500" - + " " - + " up" - + " 100 Mbps" - + " full" - + " 0" - + " 52:54:00:26:7f:a0" - + " " - + " " - + " 52:54:00:26:7F:A0" - + " 1500" - + " " - + " none" - + " " - + " " - + " " - + " " - + " " - + " " - + MAC - + "" - + "
" - + IP - + "
" - + " 255.255.255.0" - + " " - + BR - + "" - + "
" - + " " - + " " - + PHY - + "" - + " " - + " static" - + "
" - + " " - + " " - + " 52:54:00:26:7F:A0" - + " " - + " " - + " bond1" - + " " - + " none" - + " " - + " " - + " \"" - + " " - + CONTROLMAC - + "" - + " " - + " " - + " " - + " none" - + " " - + " " - + " " - + " 52:54:00:26:7F:A0" - + " " - + " " - + " bond1.200" - + " " - + " none" - + " " - + "
" - + " " - + " " - + "
" - + "
" - + "
"); - - public String getDiscoverNetwork() { - return DISCOVERNETWORK; - } - - @Test - public void testDiscoverNetwork() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(net.discoverNetwork(), false); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERNETWORK)); - results.basicBooleanTest(net.discoverNetwork()); - results.basicStringTest(net.getBridgeByIp(IP).getName(), INT); - results.basicStringTest(net.getBridgeByName(INT).getAddress(), IP); - results.basicStringTest(net.getInterfaceByName(CONTROL).getMac(), CONTROLMAC); - net.getBridgeByIp(""); - results.basicBooleanTest(net.getSuccess(), false); - net.getBridgeByName(""); - results.basicBooleanTest(net.getSuccess(), false); - // results.basicStringTest(net.getBridgeByIp("").getName(), INT); - results.basicStringTest(net.getInterfaceByIp(IP).getName(), INT); - results.basicStringTest(net.getInterfaceByName(INT).getAddress(), IP); - results.basicStringTest(net.getInterfaceByName(INT).getBroadcast(), BR); - results.basicStringTest(net.getInterfaceByName(INT).getMac(), MAC); - results.basicStringTest(net.getPhysicalByBridgeName(INT), PHY); - - } - - @Test - public void testInterfacesNotFound() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(net.discoverNetwork(), false); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERNETWORK)); - results.basicBooleanTest(net.discoverNetwork()); - if (net.getInterfaceByName(CONTROL+ "xx") == null) { - System.out.println("yay!"); - }; - } - - @Test(expected = Ovm3ResourceException.class) - public void testLocalBreak() throws Ovm3ResourceException { - con.setResult(results - .errorResponseWrap( - 1, - "exceptions.RuntimeError:Command: ['/etc/xen/scripts/linuxbridge/ovs-local-bridge', 'start', 'bridge=control0'] failed (1): stderr: Start local network: Bridge control0 Is Busy")); - results.basicBooleanTest(net.startOvsLocalConfig(CONTROL), false); - } - - @Test - public void testLocal() throws Ovm3ResourceException { - String resp = "local bridge " + CONTROL; - con.setResult(results.simpleResponseWrap("start " + resp)); - results.basicBooleanTest(net.startOvsLocalConfig(CONTROL)); - con.setResult(results.simpleResponseWrap("stop " + resp)); - results.basicBooleanTest(net.stopOvsLocalConfig(CONTROL)); - } - - @Test(expected = Ovm3ResourceException.class) - public void testVlanBridgeBreak() throws Ovm3ResourceException { - con.setResult(results - .errorResponseWrap( - 1, - "exceptions.RuntimeError:Command: ['/etc/xen/scripts/linuxbridge/ovs-local-bridge', 'start', 'bridge=control0'] failed (1): stderr: Start local network: Bridge control0 Is Busy")); - results.basicBooleanTest(net.startOvsVlanBridge( - VLANINT + "." + VLAN.toString(), VLANBR, VLAN), false); - } - - @Test - public void testVlanBridge() throws Ovm3ResourceException { - String resp = "bridge=" + VLANINT + "." + VLAN.toString() + " netdev=" - + VLANBR + " vlan " + VLAN.toString(); - con.setResult(results.simpleResponseWrap("start " + resp)); - results.basicBooleanTest(net.startOvsVlanBridge( - VLANINT + "." + VLAN.toString(), VLANBR, VLAN)); - con.setResult(results.simpleResponseWrap("stop " + resp)); - results.basicBooleanTest(net.stopOvsVlanBridge( - VLANINT + "." + VLAN.toString(), VLANBR, VLAN)); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NtpTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NtpTest.java deleted file mode 100644 index 3b2629aaa414..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/NtpTest.java +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -public class NtpTest { - ConnectionTest con = new ConnectionTest(); - Ntp nTp = new Ntp(con); - XmlTestResultTest results = new XmlTestResultTest(); - String details = results.simpleResponseWrapWrapper("\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "ovm-1\n" - + "ovm-2\n" - + "\n" - + "\n" - + "\n" - + "1\n" - + "1\n" - + "\n" - + "\n"); - - public void testGetNtp() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(nTp.getDetails()); - } - - @Test - public void testEnableNtp() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(nTp.enableNtp()); - } - @Test - public void testDisableNtp() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(nTp.disableNtp()); - } - - @Test - public void testGetDetails() throws Ovm3ResourceException { - con.setResult(details); - results.basicBooleanTest(nTp.getDetails()); - results.basicBooleanTest(nTp.isRunning()); - results.basicBooleanTest(nTp.isServer()); - } - - @Test - public void testSetNTP() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(nTp.setNtp("ovm-1", true)); - con.setResult(details); - results.basicBooleanTest(nTp.getDetails()); - List ntpHosts = new ArrayList(); - nTp.setServers(ntpHosts); - results.basicBooleanTest(nTp.setNtp(true), false); - } - - @Test - public void testServerAdditionRemoval() throws Ovm3ResourceException { - List ntpHosts = new ArrayList(); - con.setResult(details); - nTp.getDetails(); - ntpHosts = nTp.getServers(); - assertEquals(ntpHosts.size(), 2); - nTp.removeServer("ovm-2"); - ntpHosts = nTp.getServers(); - assertEquals(ntpHosts.size(), 1); - nTp.removeServer("ovm-2"); - ntpHosts = nTp.getServers(); - assertEquals(ntpHosts.size(), 1); - nTp.addServer("ovm-1"); - ntpHosts = nTp.getServers(); - assertEquals(ntpHosts.size(), 1); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolOCFS2Test.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolOCFS2Test.java deleted file mode 100644 index 8b48af32801f..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolOCFS2Test.java +++ /dev/null @@ -1,110 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import org.junit.Test; - -public class PoolOCFS2Test { - ConnectionTest con = new ConnectionTest(); - PoolOCFS2 poolfs = new PoolOCFS2(con); - XmlTestResultTest results = new XmlTestResultTest(); - - private String TYPE = "nfs"; - private String UUID = "f12842eb-f5ed-3fe7-8da1-eb0e17f5ede8"; - private String BOGUSUUID = "deadbeef-dead-beef-dead-beef0000002d"; - private String TARGET = "cs-mgmt:/volumes/cs-data/primary/ovm/VirtualMachines"; - private String BASE = "f12842ebf5ed3fe78da1eb0e17f5ede8"; - private String MANAGER = "d1a749d4295041fb99854f52ea4dea97"; - private String CLUSTER = MANAGER.substring(0, 15); - private String VERSION = "3.0"; - private String POOLUUID = "f12842eb-f5ed-3fe7-8da1-eb0e17f5ede8"; - private String EMPTY = results.escapeOrNot("" - + "" - + ""); - private String DISCOVERPOOLFS = results - .escapeOrNot("" - + "" + "" - + "" - + TYPE - + "" - + "" - + TARGET - + "" - + "" - + UUID - + "" - + "" - + BASE - + "" - + "" - + MANAGER - + "" - + "" - + VERSION - + "" - + "" - + POOLUUID - + "" - + "" - + ""); - - @Test - public void testDiscoverPoolFS() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(EMPTY)); - results.basicBooleanTest(poolfs.hasAPoolFs(), false); - results.basicBooleanTest(poolfs.hasPoolFs(BOGUSUUID), false); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOLFS)); - poolfs.discoverPoolFs(); - results.basicStringTest(poolfs.getPoolFsId(), UUID); - results.basicStringTest(poolfs.getPoolFsManagerUuid(), MANAGER); - results.basicStringTest(poolfs.getPoolFsNFSBaseId(), BASE); - results.basicStringTest(poolfs.getPoolFsTarget(), TARGET); - results.basicStringTest(poolfs.getPoolFsUuid(), UUID); - results.basicStringTest(poolfs.getPoolFsVersion(), VERSION); - results.basicStringTest(poolfs.getPoolPoolFsId(), POOLUUID); - results.basicStringTest(poolfs.getPoolFsType(), TYPE); - results.basicBooleanTest(poolfs.hasAPoolFs()); - results.basicBooleanTest(poolfs.hasPoolFs(UUID)); - } - - @Test - public void testCreatePoolFS() throws Ovm3ResourceException { - con.setResult(results.getNil()); - poolfs.createPoolFs(TYPE, TARGET, CLUSTER, UUID, BASE, MANAGER); - - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOLFS)); - results.basicBooleanTest(poolfs.hasPoolFs(UUID)); - poolfs.createPoolFs(TYPE, TARGET, CLUSTER, UUID, BASE, MANAGER); - } - - @Test - public void testDestroyPoolFS() throws Ovm3ResourceException { - con.setResult(results.getNil()); - poolfs.destroyPoolFs(TYPE, TARGET, UUID, BASE); - - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOLFS)); - results.basicBooleanTest(poolfs.hasPoolFs(UUID)); - poolfs.createPoolFs(TYPE, TARGET, CLUSTER, UUID, BASE, MANAGER); - } - - @Test(expected = Ovm3ResourceException.class) - public void testCreatePoolFSError() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOLFS)); - poolfs.createPoolFs(TYPE, TARGET, CLUSTER, BOGUSUUID, BASE, MANAGER); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolTest.java deleted file mode 100644 index f1c683570373..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/PoolTest.java +++ /dev/null @@ -1,180 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -public class PoolTest { - ConnectionTest con = new ConnectionTest(); - Pool pool = new Pool(con); - XmlTestResultTest results = new XmlTestResultTest(); - - private String UUID = "0004fb0000020000ba9aaf00ae5e2d73"; - private String BOGUSUUID = "deadbeefdeadbeefdeadbeefdeadbeef"; - private String VIP = "192.168.1.230"; - private String ALIAS = "Pool 0"; - private String HOST = "ovm-1"; - private String HOST2 = "ovm-2"; - private String IP = "192.168.1.64"; - private String IP2 = "192.168.1.65"; - private String EMPTY = results.escapeOrNot("" - + ""); - private String DISCOVERPOOL = results - .escapeOrNot("" - + "" + " " - + " " - + UUID - + "" - + " " - + ALIAS - + "" - + " " - + VIP - + "" - + " " - + " " - + " " - + IP - + "" - + " " - + " " - + " " - + IP2 - + "" - + " " - + " " - + " " + ""); - - - @Test - public void testDiscoverServerPool() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(EMPTY)); - results.basicBooleanTest(pool.isInAPool(), false); - results.basicBooleanTest(pool.isInPool(UUID), false); - results.basicBooleanTest(pool.discoverServerPool(), false); - results.basicBooleanTest(pool.isInPool(UUID), false); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest(pool.discoverServerPool()); - results.basicBooleanTest(pool.isInAPool(), true); - results.basicBooleanTest(pool.isInPool(UUID), true); - results.basicStringTest(pool.getPoolId(), UUID); - results.basicStringTest(pool.getPoolId(), UUID); - results.basicStringTest(pool.getPoolAlias(), ALIAS); - results.basicStringTest(pool.getPoolMasterVip(), VIP); - results.basicBooleanTest(pool.getPoolMemberList().contains(IP)); - results.basicBooleanTest(pool.getPoolMemberList().contains(IP2)); - } - - @Test - public void poolMembers() throws Ovm3ResourceException { - List poolHosts = new ArrayList(); - poolHosts.add(IP); - poolHosts.add(IP2); - con.setResult(results.simpleResponseWrapWrapper(EMPTY)); - results.basicBooleanTest(pool.getPoolMemberList().contains(IP), false); - - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest(pool.discoverServerPool()); - con.setResult(results.getNil()); - results.basicBooleanTest(pool.removePoolMember(IP), true); - results.basicBooleanTest(pool.addPoolMember(IP), true); - results.basicBooleanTest(pool.setPoolMemberList(poolHosts), true); - } - - @Test - public void testCreateServerPool() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest( - pool.createServerPool(ALIAS, UUID, VIP, 1, HOST, IP), true); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest(pool.discoverServerPool()); - results.basicBooleanTest( - pool.createServerPool(ALIAS, UUID, VIP, 1, HOST, IP), true); - - } - - @Test(expected = Ovm3ResourceException.class) - public void testCreateServerPoolFail1() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest( - pool.createServerPool(ALIAS, BOGUSUUID, VIP, 1, HOST, IP), - false); - } - - @Test(expected = Ovm3ResourceException.class) - public void testCreateServerPoolFail2() throws Ovm3ResourceException { - con.setResult(results.errorResponseWrap(1, - "exceptions.Exception:Repository already exists")); - results.basicBooleanTest( - pool.createServerPool(ALIAS, UUID, VIP, 1, HOST, IP), false); - } - - @Test - public void testJoinServerPool() throws Ovm3ResourceException { - con.setResult(results.getNil()); - Integer poolsize = 2; - results.basicBooleanTest( - pool.joinServerPool(ALIAS, UUID, VIP, poolsize, HOST2, IP2), - true); - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest(pool.discoverServerPool()); - results.basicBooleanTest( - pool.joinServerPool(ALIAS, UUID, VIP, poolsize, HOST2, IP2), - true); - } - @Test(expected = Ovm3ResourceException.class) - public void testJoinServerPoolFail1() throws Ovm3ResourceException { - Integer poolsize = 2; - con.setResult(results.simpleResponseWrapWrapper(DISCOVERPOOL)); - results.basicBooleanTest(pool.joinServerPool(ALIAS, BOGUSUUID, VIP, - poolsize, HOST2, IP2), false); - } - - @Test(expected = Ovm3ResourceException.class) - public void testJoinServerPoolFail() throws Ovm3ResourceException { - con.setResult(results - .errorResponseWrap(1, - "exceptions.Exception:Server already a member of pool: " - + UUID)); - Integer poolsize = 2; - results.basicBooleanTest(pool.joinServerPool(ALIAS, UUID, VIP, poolsize, - HOST2, IP2), false); - } - - @Test - public void testValidPoolRoles() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(pool.setServerRoles(pool.getValidRoles()), - true); - - } - - @Test(expected = Ovm3ResourceException.class) - public void testValidPoolRolesInvalid() throws Ovm3ResourceException { - String broken = "broken_token"; - con.setResult(results - .errorResponseWrap(1, - "exceptions.Exception:Invalid roles: set(['xen', '" + broken - + "', 'utility'])")); - results.basicBooleanTest(pool.setServerRoles(pool.getValidRoles()), - false); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RemoteTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RemoteTest.java deleted file mode 100644 index db811735d952..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RemoteTest.java +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; -import org.junit.Test; - -public class RemoteTest { - ConnectionTest con = new ConnectionTest(); - Remote rEm = new Remote(con); - XmlTestResultTest results = new XmlTestResultTest(); - - @Test - public void TestSysShutdown() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(rEm.sysShutdown()); - } - @Test - public void TestSysReboot() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(rEm.sysReboot()); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RepositoryTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RepositoryTest.java deleted file mode 100644 index 54e1ebd53595..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/RepositoryTest.java +++ /dev/null @@ -1,182 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import org.junit.Test; - -public class RepositoryTest { - ConnectionTest con = new ConnectionTest(); - Repository repo = new Repository(con); - XmlTestResultTest results = new XmlTestResultTest(); - - private String REPOID = "f12842ebf5ed3fe78da1eb0e17f5ede8"; - private String MGRID = "d1a749d4295041fb99854f52ea4dea97"; - private String REPOALIAS = "OVS Repository"; - private String REMOTENFS = "cs-mgmt:/volumes/cs-data/primary/ovm"; - private String LOCALMOUNT = "/OVS/Repositories/f12842ebf5ed3fe78da1eb0e17f5ede8"; - private String REPOVERSION = "3.0"; - private String REPOSTATUS = "Mounted"; - private String ISO = "systemvm.iso"; - private String TEMPLATE = "0b53acb1-6554-41b8-b1e1-7b27a01b6acb"; - private String DISK = "cfb5ee12-b99d-41d1-a5b2-44dea36c9de1.raw"; - private String VM = "7efbdbe0-3d01-3b22-a8a0-1d41c6f2502f"; - private String REPODISCOVERXML = "" - + "<?xml version=\"1.0\" ?>" - + "<Discover_Repositories_Result>" + "<RepositoryList>" - + "<Repository Name=\"" - + REPOID - + "\">" - + "<Version>" - + REPOVERSION - + "</Version>" - + "<Manager_UUID>" - + MGRID - + "</Manager_UUID>" - + "<Repository_UUID>" - + REPOID - + "</Repository_UUID>" - + "<Repository_Alias>" - + REPOALIAS - + "</Repository_Alias>" - + "<Assemblies/>" - + "<Templates>" - + "<Template Name=\"" - + TEMPLATE - + "\">" - + "<File>" - + TEMPLATE - + ".raw</File>" - + "</Template>" - + "<Template Name=\"7d5c29db-6343-4431-b509-9646b45cc31b\">" - + "<File>7d5c29db-6343-4431-b509-9646b45cc31b.raw</File>" - + "</Template>" - + "</Templates>" - + "<VirtualMachines>" - + "<VirtualMachine Name=\"" - + VM - + "\">" - + "<File>vm.cfg</File>" - + "</VirtualMachine>" - + "<VirtualMachine Name=\"pool\">" - + "<File>ovspoolfs.img</File>" - + "</VirtualMachine>" - + "<VirtualMachine Name=\"4fb50e31-b032-3012-b70b-7e27c2acdfe2\">" - + "<File>vm.cfg</File>" - + "</VirtualMachine>" - + "<VirtualMachine Name=\"5ffe3ddc-606d-3fec-a956-67638f7ba838\">" - + "<File>vm.cfg</File>" - + "</VirtualMachine>" - + "<VirtualMachine Name=\"14fc3846-45e5-3c08-ad23-432ceb07407b\">" - + "<File>vm.cfg</File>" - + "</VirtualMachine>" - + "</VirtualMachines>" - + "<VirtualDisks>" - + "<Disk>" - + DISK - + "</Disk>" - + "<Disk>b92dd5c5-0f24-4cca-b86a-153ac6e950a8.raw</Disk>" - + "<Disk>d144c278-0825-41d5-b9c6-8bb21f3dd1e7.raw</Disk>" - + "<Disk>99650d9f-c7ee-42df-92e3-6cafc0876141.raw</Disk>" - + "</VirtualDisks>" - + "<ISOs>" - + "<ISO>" - + ISO - + "</ISO>" - + "</ISOs>" - + "</Repository>" - + "</RepositoryList>" - + "</Discover_Repositories_Result>" + ""; - private String REPODBDISCOVERXML = "" - + "<?xml version=\"1.0\" ?>" - + "<Discover_Repository_Db_Result>" - + "<RepositoryDbList>" + "<Repository Uuid=\"" - + REPOID - + "\">" - + "<Fs_location>" - + REMOTENFS - + "</Fs_location>" - + "<Mount_point>" - + LOCALMOUNT - + "</Mount_point>" - + "<Filesystem_type>nfs</Filesystem_type>" - + "<Version>" - + REPOVERSION - + "</Version>" - + "<Alias>" - + REPOALIAS - + "</Alias>" - + "<Manager_uuid>" - + MGRID - + "</Manager_uuid>" - + "<Status>" - + REPOSTATUS - + "</Status>" - + "</Repository>" - + "</RepositoryDbList>" - + "</Discover_Repository_Db_Result>" + ""; - - /* - * @Test Create a test repo that mimics the above so we can test against a - * live box... public void testCreateRepo() throws Ovm3ResourceException { - * con.setResult(null); repo.createRepo(REMOTENFS, LOCALMOUNT, REPOID, - * REPOALIAS); } - */ - @Test - public void testDiscoverRepoBase() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(this.REPODISCOVERXML)); - repo.discoverRepo(REPOID); - results.basicStringTest(repo.getRepo(REPOID).getUuid(), REPOID); - results.basicStringTest(repo.getRepo(REPOID).getAlias(), REPOALIAS); - results.basicStringTest(repo.getRepo(REPOID).getVersion(), REPOVERSION); - results.basicStringTest(repo.getRepo(REPOID).getManagerUuid(), MGRID); - } - - @Test - public void testDiscoverRepoDetails() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(this.REPODISCOVERXML)); - repo.discoverRepo(REPOID); - results.basicBooleanTest(results.basicListHasString(repo - .getRepo(REPOID).getRepoVirtualDisks(), DISK), true); - results.basicBooleanTest(results.basicListHasString(repo - .getRepo(REPOID).getRepoVirtualMachines(), VM), true); - results.basicBooleanTest(results.basicListHasString(repo - .getRepo(REPOID).getRepoTemplates(), TEMPLATE + ".raw"), true); - results.basicBooleanTest(results.basicListHasString(repo - .getRepo(REPOID).getRepoISOs(), ISO), true); - results.basicBooleanTest(results.basicListHasString(repo - .getRepo(REPOID).getRepoISOs(), VM), false); - } - - @Test - public void testDiscoverRepoDb() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(this.REPODBDISCOVERXML)); - repo.discoverRepoDb(); - results.basicStringTest(repo.getRepoDb(REPOID).getUuid(), REPOID); - results.basicStringTest(repo.getRepoDb(REPOID).getAlias(), REPOALIAS); - results.basicStringTest(repo.getRepoDb(REPOID).getVersion(), - REPOVERSION); - results.basicStringTest(repo.getRepoDb(REPOID).getManagerUuid(), MGRID); - results.basicStringTest(repo.getRepoDb(REPOID).getMountPoint(), - LOCALMOUNT); - results.basicStringTest(repo.getRepoDb(REPOID).getFsLocation(), - REMOTENFS); - results.basicStringTest(repo.getRepoDb(REPOID).getStatus(), REPOSTATUS); - results.basicStringTest(repo.getRepoDb(REPOID).getFilesystemType(), - "nfs"); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/StoragePluginTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/StoragePluginTest.java deleted file mode 100644 index d0194db25f43..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/StoragePluginTest.java +++ /dev/null @@ -1,356 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -import com.cloud.hypervisor.ovm3.objects.StoragePlugin.FileProperties; -import com.cloud.hypervisor.ovm3.objects.StoragePlugin.StorageDetails; - -public class StoragePluginTest { - ConnectionTest con = new ConnectionTest(); - StoragePlugin sPt = new StoragePlugin(con); - XmlTestResultTest results = new XmlTestResultTest(); - String NFSHOST = "nfs-store-1"; - String NFSPATH = "/volumes/cs-data/primary"; - String NFSMNT = "/nfsmnt"; - String FSPROPUUID = sPt.deDash(sPt.newUuid()); - String FSMNTUUID = sPt.newUuid(); - String POOLUUID = sPt.deDash(FSMNTUUID); - String FILE = "a.file"; - Long SIZE = 2096898048L; - String STORAGEPLUGINXML = "" - + "<?xml version=\"1.0\" ?>" - + "<Discover_Storage_Plugins_Result>" - + "<storage_plugin_info_list>" - + "<storage_plugin_info plugin_impl_name=\"oracle.ocfs2.OCFS2.OCFS2Plugin\">" - + "<fs_api_version>1,2,7</fs_api_version>" - + "<generic_plugin>False</generic_plugin>" - + "<plugin_version>0.1.0-38</plugin_version>" - + "<filesys_type>LocalFS</filesys_type>" - + "<extended_api_version>None</extended_api_version>" - + "<plugin_desc>Oracle OCFS2 File system Storage Connect Plugin</plugin_desc>" - + "<cluster_required>True</cluster_required>" - + "<plugin_name>Oracle OCFS2 File system</plugin_name>" - + "<fs_extra_info_help>None</fs_extra_info_help>" - + "<required_api_vers>1,2,7</required_api_vers>" - + "<file_extra_info_help>None</file_extra_info_help>" - + "<ss_extra_info_help>None</ss_extra_info_help>" - + "<filesys_name>ocfs2</filesys_name>" - + "<vendor_name>Oracle</vendor_name>" - + "<plugin_type>ifs</plugin_type>" - + "<abilities>" - + "<resize_is_sync>YES</resize_is_sync>" - + "<clone_is_sync>YES</clone_is_sync>" - + "<access_control>NO</access_control>" - + "<custom_clone_name>YES</custom_clone_name>" - + "<require_storage_name>NO</require_storage_name>" - + "<backing_device_type>DEVICE_SINGLE</backing_device_type>" - + "<splitclone_while_open>NO</splitclone_while_open>" - + "<custom_snap_name>YES</custom_snap_name>" - + "<snapshot>ONLINE</snapshot>" - + "<splitclone>UNSUPPORTED</splitclone>" - + "<snap_is_sync>YES</snap_is_sync>" - + "<snapclone>ONLINE</snapclone>" - + "<splitclone_is_sync>NO</splitclone_is_sync>" - + "<clone>ONLINE</clone>" - + "<resize>ONLINE</resize>" - + "<snapclone_is_sync>YES</snapclone_is_sync>" - + "</abilities>" - + "</storage_plugin_info>" - + "<storage_plugin_info plugin_impl_name=\"oracle.generic.SCSIPlugin.GenericPlugin\">" - + "<storage_types>SAN,iSCSI</storage_types>" - + "<generic_plugin>True</generic_plugin>" - + "<plugin_version>1.1.0</plugin_version>" - + "<extended_api_version>1,2,9</extended_api_version>" - + "<plugin_desc>Oracle Storage Connect Plugin for Generic FC and iSCSI</plugin_desc>" - + "<plugin_name>Oracle Generic SCSI Plugin</plugin_name>" - + "<sa_api_version>1,2,7</sa_api_version>" - + "<required_api_vers>1,2,7</required_api_vers>" - + "<ss_extra_info_help>None</ss_extra_info_help>" - + "<se_extra_info_help>None</se_extra_info_help>" - + "<vendor_name>Oracle</vendor_name>" - + "<plugin_type>isa</plugin_type>" - + "<abilities>" - + "<resize_is_sync>UNSUPPORTED</resize_is_sync>" - + "<clone_is_sync>UNSUPPORTED</clone_is_sync>" - + "<access_control>NO</access_control>" - + "<custom_clone_name>UNSUPPORTED</custom_clone_name>" - + "<require_storage_name>UNSUPPORTED</require_storage_name>" - + "<custom_snap_name>UNSUPPORTED</custom_snap_name>" - + "<snapshot>UNSUPPORTED</snapshot>" - + "<splitclone>UNSUPPORTED</splitclone>" - + "<snap_is_sync>UNSUPPORTED</snap_is_sync>" - + "<snapclone>UNSUPPORTED</snapclone>" - + "<splitclone_is_sync>UNSUPPORTED</splitclone_is_sync>" - + "<clone>UNSUPPORTED</clone>" - + "<resize>UNSUPPORTED</resize>" - + "<snapclone_is_sync>UNSUPPORTED</snapclone_is_sync>" - + "</abilities>" - + "</storage_plugin_info>" - + "<storage_plugin_info plugin_impl_name=\"oracle.generic.NFSPlugin.GenericNFSPlugin\">" - + "<fs_api_version>1,2,7</fs_api_version>" - + "<generic_plugin>True</generic_plugin>" - + "<plugin_version>1.1.0</plugin_version>" - + "<filesys_type>NetworkFS</filesys_type>" - + "<extended_api_version>None</extended_api_version>" - + "<plugin_desc>Oracle Generic Network File System Storage Connect Plugin</plugin_desc>" - + "<cluster_required>False</cluster_required>" - + "<plugin_name>Oracle Generic Network File System</plugin_name>" - + "<fs_extra_info_help>None</fs_extra_info_help>" - + "<required_api_vers>1,2,7</required_api_vers>" - + "<file_extra_info_help>None</file_extra_info_help>" - + "<ss_extra_info_help>None</ss_extra_info_help>" - + "<filesys_name>NFS</filesys_name>" - + "<vendor_name>Oracle</vendor_name>" - + "<plugin_type>ifs</plugin_type>" - + "<abilities>" - + "<resize_is_sync>UNSUPPORTED</resize_is_sync>" - + "<clone_is_sync>UNSUPPORTED</clone_is_sync>" - + "<access_control>NO</access_control>" - + "<custom_clone_name>UNSUPPORTED</custom_clone_name>" - + "<require_storage_name>NO</require_storage_name>" - + "<backing_device_type>UNSUPPORTED</backing_device_type>" - + "<splitclone_while_open>UNSUPPORTED</splitclone_while_open>" - + "<custom_snap_name>UNSUPPORTED</custom_snap_name>" - + "<snapshot>UNSUPPORTED</snapshot>" - + "<splitclone>UNSUPPORTED</splitclone>" - + "<snap_is_sync>UNSUPPORTED</snap_is_sync>" - + "<snapclone>UNSUPPORTED</snapclone>" - + "<splitclone_is_sync>UNSUPPORTED</splitclone_is_sync>" - + "<clone>UNSUPPORTED</clone>" - + "<resize>UNSUPPORTED</resize>" - + "<snapclone_is_sync>UNSUPPORTED</snapclone_is_sync>" - + "</abilities>" + "</storage_plugin_info>" - + "</storage_plugin_info_list>" - + "</Discover_Storage_Plugins_Result>" + ""; - String NFSMOUNTRESPONSEXML = "" + "" - + "status" + "" - + "" + "" + "uuid" - + "" - + FSPROPUUID - + "" - + "" - + "" - + "ss_uuid" - + "" - + FSMNTUUID - + "" - + "" - + "" - + "size" - + "263166853120" - + "" - + "" - + "free_sz" - + "259377299456" - + "" - + "" - + "state" - + "1" - + "" - + "" - + "mount_options" - + "" - + "" - + "" - + "" - + "access_grp_names" - + "" - + "" - + "" - + "" - + "access_path" - + "" - + NFSHOST - + ":" - + NFSPATH - + "" - + "" - + "" - + "name" - + "nfs:" - + NFSPATH - + "" + "" + ""; - public String getNfsMountResponseXml() { - return NFSMOUNTRESPONSEXML; - } - - public String getNfsFileSystemInfo() { - return NFSFILESYSTEMINFO; - } - public String getFileCreateXml() { - return FILECREATEXML; - } - public Long getFileSize() { - return SIZE; - } - public String getPoolUuid() { - return POOLUUID; - } - public String getFileName() { - return FILE; - } - String NFSFILESYSTEMINFO = NFSMOUNTRESPONSEXML; - String FILECREATEXML = "" + "" + "fr_type" - + "File" + "" + "" - + "ondisk_sz" + "0" - + "" + "" + "fs_uuid" - + "" + FSMNTUUID + "" + "" - + "" + "file_path" - + "/OVS/Repositories/" + POOLUUID + "/VirtualDisks/" - + FILE + "" + "" + "" - + "file_sz" + "" + SIZE - + "" + "" + ""; - - @Test - public void testNFSStorageMountCreation() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML)); - StorageDetails sd = sPt.storagePluginMountNFS(NFSHOST, NFSPATH, - FSMNTUUID, NFSMNT); - con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML)); - NFSMNT = NFSMNT + "/" + FSMNTUUID; - sd = sPt.storagePluginMountNFS(NFSHOST, NFSPATH, FSMNTUUID, NFSMNT); - results.basicLongTest(Long.valueOf(sd.getSize()), 263166853120L); - results.basicLongTest(Long.valueOf(sd.getFreeSize()), 259377299456L); - results.basicStringTest(sd.getName(), "nfs:" + NFSPATH); - results.basicStringTest(sd.getUuid(), FSPROPUUID); - results.basicStringTest(sd.getDetailsRelationalUuid(),FSMNTUUID); - } - - @Test - public void testNFSStorageUnmount() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(sPt.storagePluginUnmountNFS(NFSHOST, NFSPATH, FSMNTUUID, NFSMNT)); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStoragePluginIncorrectSsUuid() throws Ovm3ResourceException { - sPt.getStorageDetails().setDetailsRelationalUuid(FSMNTUUID); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStoragePluginIncorrectMntUuid() - throws Ovm3ResourceException { - sPt.getStorageDetails().setUuid(FSPROPUUID); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStoragePluginIncorrectUuid() throws Ovm3ResourceException { - sPt.getStorageServer().setUuid(FSMNTUUID); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStoragePluginNFSmountInvalidUuid() - throws Ovm3ResourceException { - NFSMOUNTRESPONSEXML = NFSMOUNTRESPONSEXML.replaceAll(FSPROPUUID, - sPt.deDash(FSMNTUUID)); - con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML)); - assertNotNull(sPt.storagePluginMountNFS(NFSHOST, NFSPATH, - FSPROPUUID, NFSMNT)); - } - - @Test - public void testStorageFileCreation() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(FILECREATEXML)); - FileProperties file = sPt.storagePluginCreate(FSMNTUUID, NFSHOST, FILE, - SIZE, false); - file.getOnDiskSize(); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStorageFileCreationFileExistS() - throws Ovm3ResourceException { - con.setResult(results - .errorResponseWrap("exceptions OSError:[Errno.17] File exists " - + FILE)); - FileProperties file = sPt.storagePluginCreate(FSMNTUUID, NFSHOST, FILE, - SIZE, false); - file.getSize(); - } - - @Test - public void testStorageFileInfo() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(FILECREATEXML)); - FileProperties file = sPt.storagePluginGetFileInfo(FSMNTUUID, NFSHOST, - FILE); - file.getName(); - file.getUuid(); - file.getType(); - file.getSize(); - } - - @Test - public void testDiscoverStoragePlugins() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(STORAGEPLUGINXML)); - for (String plugin : sPt.discoverStoragePlugins()) { - sPt.checkStoragePluginProperties(plugin, "plugin_version"); - sPt.checkStoragePluginAbility(plugin, "snapshot"); - } - } - - @Test(expected = Ovm3ResourceException.class) - public void testCheckStoragePluginBogusPlugin() - throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(STORAGEPLUGINXML)); - sPt.checkStoragePluginProperties("bogus", "plugin_version"); - } - - @Test(expected = Ovm3ResourceException.class) - public void testCheckStoragePluginBogusProperty() - throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(STORAGEPLUGINXML)); - sPt.checkStoragePluginAbility(sPt.getPluginType(), "blabla"); - } - - @Test - public void testMounts() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML)); - sPt.storagePluginListFs(NFSHOST); - } - - @Test - public void testGetFileSystemInfo() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(NFSMOUNTRESPONSEXML)); - sPt.storagePluginGetFileSystemInfo(FSPROPUUID, FSMNTUUID, NFSHOST, - NFSPATH); - } - - @Test - public void testStoragepluginDestroy() throws Ovm3ResourceException { - con.setResult(results.getNil()); - sPt.storagePluginDestroy(FSMNTUUID, FILE); - } - - @Test(expected = Ovm3ResourceException.class) - public void testStoragepluginDestroyWrongUUID() - throws Ovm3ResourceException { - con.setResult(results.getNil()); - sPt.storagePluginDestroy(FSPROPUUID, FILE); - } - - @Test - public void testStoragePluginSwitch() throws Ovm3ResourceException { - con.setResult(results.simpleResponseWrapWrapper(STORAGEPLUGINXML)); - sPt.setISCSI(); - sPt.setNFS(); - sPt.setOCFS2(); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java deleted file mode 100644 index d8e80217721a..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XenTest.java +++ /dev/null @@ -1,1490 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import java.util.UUID; - -import org.junit.Test; - -public class XenTest { - public XenTest() { - } - ConnectionTest con = new ConnectionTest(); - Xen xEn = new Xen(con); - XmlTestResultTest results = new XmlTestResultTest(); - String DOM0VMNAME = "Domain-0"; - String VMNAME = "i-2-3-VM"; - String VMROOTDISKNAME = "ROOT-3"; - public String getVMNAME() { - return VMNAME; - } - String REPOID = "f12842ebf5ed3fe78da1eb0e17f5ede8"; - public String getRepoId() { - return REPOID; - } - public String getVmId() { - return VMID; - } - String VMNICMAC = "02:00:50:9a:00:01"; - public String getVmNicMac() { - return VMNICMAC; - } - public String getVmNicBridge() { - return VMNICBR; - } - public String getVmNicUuid() { - return VMNICUUID; - } - String VMNICBR = "xenbr0.160"; - String VMNICUUID = "2ad52371-af7d-32d1-ebe1-2b6a811e66c4"; - String VMID = "868a6627-c3b0-3d9b-aea4-f279cbaa253b"; - String VMROOTDISKUUID = "722eb520-dcf5-4113-8f45-22d67c9a2f3c"; - public String getVmRootDiskUuid() { - return VMROOTDISKUUID; - } - public String getVmRootDiskName() { - return VMROOTDISKNAME; - } - String VMROOTDISK = VMROOTDISKUUID + ".raw"; - String VMISO = "xentools.iso"; - String REPOPATH = "/OVS/Repositories"; - String VMROOTDISKPATH = REPOPATH + "/" + REPOID + "/Disks/" + VMROOTDISK; - String VMISOPATH = REPOPATH + "/" + REPOID + "/ISOs/" + VMISO; - String MULTIPLEVMSLISTXML = results - .simpleResponseWrapWrapper("\n" - + "\n" - + "\n" - + "on_xend_stop\n" - + "ignore\n" - + "\n" - + "\n" - + "features\n" - + "\n" - + "\n" - + "\n" - + "image\n" - + "\n" - + "\n" - + "tsc_mode\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "kernel\n" - + "\n" - + "\n" - + "\n" - + "superpages\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "nomigrate\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "expose_host_uuid\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "cpus\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "10\n" - + "11\n" - + "12\n" - + "13\n" - + "14\n" - + "15\n" - + "16\n" - + "17\n" - + "18\n" - + "19\n" - + "20\n" - + "21\n" - + "22\n" - + "23\n" - + "24\n" - + "25\n" - + "26\n" - + "27\n" - + "28\n" - + "29\n" - + "30\n" - + "31\n" - + "32\n" - + "33\n" - + "34\n" - + "35\n" - + "36\n" - + "37\n" - + "38\n" - + "39\n" - + "40\n" - + "41\n" - + "42\n" - + "43\n" - + "44\n" - + "45\n" - + "46\n" - + "47\n" - + "48\n" - + "49\n" - + "50\n" - + "51\n" - + "52\n" - + "53\n" - + "54\n" - + "55\n" - + "56\n" - + "57\n" - + "58\n" - + "59\n" - + "60\n" - + "61\n" - + "62\n" - + "63\n" - + "64\n" - + "65\n" - + "66\n" - + "67\n" - + "68\n" - + "69\n" - + "70\n" - + "71\n" - + "72\n" - + "73\n" - + "74\n" - + "75\n" - + "76\n" - + "77\n" - + "78\n" - + "79\n" - + "80\n" - + "81\n" - + "82\n" - + "83\n" - + "84\n" - + "85\n" - + "86\n" - + "87\n" - + "88\n" - + "89\n" - + "90\n" - + "91\n" - + "92\n" - + "93\n" - + "94\n" - + "95\n" - + "96\n" - + "97\n" - + "98\n" - + "99\n" - + "100\n" - + "101\n" - + "102\n" - + "103\n" - + "104\n" - + "105\n" - + "106\n" - + "107\n" - + "108\n" - + "109\n" - + "110\n" - + "111\n" - + "112\n" - + "113\n" - + "114\n" - + "115\n" - + "116\n" - + "117\n" - + "118\n" - + "119\n" - + "120\n" - + "121\n" - + "122\n" - + "123\n" - + "124\n" - + "125\n" - + "126\n" - + "127\n" - + "128\n" - + "129\n" - + "130\n" - + "131\n" - + "132\n" - + "133\n" - + "134\n" - + "135\n" - + "136\n" - + "137\n" - + "138\n" - + "139\n" - + "140\n" - + "141\n" - + "142\n" - + "143\n" - + "144\n" - + "145\n" - + "146\n" - + "147\n" - + "148\n" - + "149\n" - + "150\n" - + "151\n" - + "152\n" - + "153\n" - + "154\n" - + "155\n" - + "156\n" - + "157\n" - + "158\n" - + "159\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "10\n" - + "11\n" - + "12\n" - + "13\n" - + "14\n" - + "15\n" - + "16\n" - + "17\n" - + "18\n" - + "19\n" - + "20\n" - + "21\n" - + "22\n" - + "23\n" - + "24\n" - + "25\n" - + "26\n" - + "27\n" - + "28\n" - + "29\n" - + "30\n" - + "31\n" - + "32\n" - + "33\n" - + "34\n" - + "35\n" - + "36\n" - + "37\n" - + "38\n" - + "39\n" - + "40\n" - + "41\n" - + "42\n" - + "43\n" - + "44\n" - + "45\n" - + "46\n" - + "47\n" - + "48\n" - + "49\n" - + "50\n" - + "51\n" - + "52\n" - + "53\n" - + "54\n" - + "55\n" - + "56\n" - + "57\n" - + "58\n" - + "59\n" - + "60\n" - + "61\n" - + "62\n" - + "63\n" - + "64\n" - + "65\n" - + "66\n" - + "67\n" - + "68\n" - + "69\n" - + "70\n" - + "71\n" - + "72\n" - + "73\n" - + "74\n" - + "75\n" - + "76\n" - + "77\n" - + "78\n" - + "79\n" - + "80\n" - + "81\n" - + "82\n" - + "83\n" - + "84\n" - + "85\n" - + "86\n" - + "87\n" - + "88\n" - + "89\n" - + "90\n" - + "91\n" - + "92\n" - + "93\n" - + "94\n" - + "95\n" - + "96\n" - + "97\n" - + "98\n" - + "99\n" - + "100\n" - + "101\n" - + "102\n" - + "103\n" - + "104\n" - + "105\n" - + "106\n" - + "107\n" - + "108\n" - + "109\n" - + "110\n" - + "111\n" - + "112\n" - + "113\n" - + "114\n" - + "115\n" - + "116\n" - + "117\n" - + "118\n" - + "119\n" - + "120\n" - + "121\n" - + "122\n" - + "123\n" - + "124\n" - + "125\n" - + "126\n" - + "127\n" - + "128\n" - + "129\n" - + "130\n" - + "131\n" - + "132\n" - + "133\n" - + "134\n" - + "135\n" - + "136\n" - + "137\n" - + "138\n" - + "139\n" - + "140\n" - + "141\n" - + "142\n" - + "143\n" - + "144\n" - + "145\n" - + "146\n" - + "147\n" - + "148\n" - + "149\n" - + "150\n" - + "151\n" - + "152\n" - + "153\n" - + "154\n" - + "155\n" - + "156\n" - + "157\n" - + "158\n" - + "159\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "uuid\n" - + "00000000-0000-0000-0000-000000000000\n" - + "\n" - + "\n" - + "on_reboot\n" - + "restart\n" - + "\n" - + "\n" - + "state\n" - + "r-----\n" - + "\n" - + "\n" - + "cpu_weight\n" - + "65535\n" - + "\n" - + "\n" - + "online_vcpus\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "memory\n" - + "672\n" - + "\n" - + "\n" - + "cpu_cap\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "status\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "pool_name\n" - + "Pool-0\n" - + "\n" - + "\n" - + "on_poweroff\n" - + "destroy\n" - + "\n" - + "\n" - + "on_xend_start\n" - + "ignore\n" - + "\n" - + "\n" - + "on_crash\n" - + "restart\n" - + "\n" - + "\n" - + "device\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "bootloader\n" - + "\n" - + "\n" - + "\n" - + "maxmem\n" - + "672\n" - + "\n" - + "\n" - + "cpu_time\n" - + "6608.51291287\n" - + "\n" - + "\n" - + "shadow_memory\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "name\n" - + "Domain-0\n" - + "\n" - + "\n" - + "builder\n" - + "linux\n" - + "\n" - + "\n" - + "bootloader_args\n" - + "\n" - + "\n" - + "\n" - + "domid\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vcpus\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "on_xend_stop\n" - + "ignore\n" - + "\n" - + "\n" - + "console_mfn\n" - + "873706\n" - + "\n" - + "\n" - + "features\n" - + "\n" - + "\n" - + "\n" - + "image\n" - + "\n" - + "\n" - + "tsc_mode\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "kernel\n" - + "\n" - + "\n" - + "\n" - + "videoram\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "device_model\n" - + "/usr/lib/xen/bin/qemu-dm\n" - + "\n" - + "\n" - + "notes" - + "" - + "" - + "HV_START_LOW" - + "4118806528" - + "" - + "" - + "FEATURES" - + "!writable_page_tables|pae_pgdir_above_4gb" - + "" + "" - + "VIRT_BASE" - + "3221225472" - + "" + "" - + "GUEST_VERSION" - + "2.6" - + "" + "" - + "PADDR_OFFSET" - + "" + "" - + "" + "" - + "GUEST_OS" - + "linux" - + "" + "" - + "HYPERCALL_PAGE" - + "3238010880" - + "" + "" - + "LOADER" - + "generic" - + "" + "" - + "SUSPEND_CANCEL" - + "" + "" - + "" + "" - + "PAE_MODE" - + "yes" - + "" + "" - + "ENTRY" - + "3242303488" - + "" + "" - + "XEN_VERSION" - + "xen-3.0" - + "" + "" - + "" + "" - + "expose_host_uuid" + "" - + "" + "" + "" - + "pci" + "" - + "" + "" + "" - + "superpages\n" + "\n" - + "\n" + "\n" + "\n" - + "nomigrate\n" + "\n" - + "\n" + "\n" - + "\n" + "\n" + "\n" - + "cpus\n" + "\n" - + "\n" + "\n" - + "\n" + "\n" - + "\n" + "store_mfn\n" - + "873707\n" - + "\n" + "\n" + "uuid\n" - + "" - + VMID - + "\n" - + "\n" - + "\n" - + "on_reboot\n" - + "restart\n" - + "\n" - + "\n" - + "state\n" - + "-b----\n" - + "\n" - + "\n" - + "cpu_weight\n" - + "27500\n" - + "\n" - + "\n" - + "online_vcpus\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "memory\n" - + "512\n" - + "\n" - + "\n" - + "cpu_cap\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "status\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "pool_name\n" - + "Pool-0\n" - + "\n" - + "\n" - + "description\n" - + "\n" - + "\n" - + "\n" - + "start_time\n" - + "1408105444.17\n" - + "\n" - + "\n" - + "on_poweroff\n" - + "destroy\n" - + "\n" - + "\n" - + "on_xend_start\n" - + "ignore\n" - + "\n" - + "\n" - + "on_crash\n" - + "restart\n" - + "\n" - + "\n" - + "device\n" - + "\n" - + "\n" - + "vif\n" - + "\n" - + "\n" - + "\n" - + "bridge\n" - + ""+VMNICBR+"\n" - + "\n" - + "\n" - + "mac\n" - + "" + VMNICMAC + "\n" - + "\n" - + "\n" - + "script\n" - + "/etc/xen/scripts/vif-bridge\n" - + "\n" - + "\n" - + "uuid\n" - + ""+VMNICUUID+"\n" - + "\n" - + "\n" - + "backend\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vkbd\n" - + "\n" - + "\n" - + "\n" - + "backend\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "console\n" - + "\n" - + "\n" - + "\n" - + "protocol\n" - + "vt100\n" - + "\n" - + "\n" - + "location\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "uuid\n" - + "9beb5016-dde7-8526-491f-e972f262a634\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vfb\n" - + "\n" - + "\n" - + "\n" - + "vncunused\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vnc\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "xauthority\n" - + "/root/.Xauthority\n" - + "\n" - + "\n" - + "vnclisten\n" - + "0.0.0.0\n" - + "\n" - + "\n" - + "vncpasswd\n" - + "7693f834ca67912e\n" - + "\n" - + "\n" - + "keymap\n" - + "en-us\n" - + "\n" - + "\n" - + "location\n" - + "0.0.0.0:5900\n" - + "\n" - + "\n" - + "uuid\n" - + "78edf954-e375-b142-9c76-791ce805b6ef\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vbd\n" - + "\n" - + "\n" - + "\n" - + "protocol\n" - + "x86_32-abi\n" - + "\n" - + "\n" - + "uuid\n" - + "bda35954-2596-025e-168c-b82e1cf92369\n" - + "\n" - + "\n" - + "bootable\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "dev\n" - + "xvda:disk\n" - + "\n" - + "\n" - + "uname\n" - + "file:/OVS/Repositories/" - + REPOID - + "/VirtualDisks/" - + VMROOTDISK - + "\n" - + "\n" - + "\n" - + "mode\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "VDI\n" - + "\n" - + "\n" - + "\n" - + "backend\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "bootloader\n" - + "/usr/bin/pygrub\n" - + "\n" - + "\n" - + "maxmem\n" - + "512\n" - + "\n" - + "\n" - + "cpu_time\n" - + "0.152510481\n" - + "\n" - + "\n" - + "shadow_memory\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "name\n" - + "" - + VMNAME - + "\n" - + "\n" - + "\n" - + "builder\n" - + "linux\n" - + "\n" - + "\n" - + "bootloader_args\n" - + "-q\n" - + "\n" - + "\n" - + "domid\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "vcpus\n" - + "\n" - + "\n" - + "\n" + "\n" + ""); - - public String getSingleVmListXML() { - return SINGLEVMLISTXML; - } - String SINGLEVMLISTXML = results - .simpleResponseWrapWrapper("" - + "" - + "on_xend_stop" - + "ignore" - + "" - + "" - + "console_mfn" - + "873706" - + "" - + "" - + "features" - + "" - + "" - + "" - + "image" - + "" - + "" - + "tsc_mode" - + "" - + "" - + "" - + "" - + "kernel" - + "" - + "" - + "" - + "videoram" - + "" - + "" - + "" - + "" - + "device_model" - + "/usr/lib/xen/bin/qemu-dm" - + "" - + "" - + "notes" - + "" - + "" - + "HV_START_LOW" - + "4118806528" - + "" - + "" - + "FEATURES" - + "!writable_page_tables|pae_pgdir_above_4gb" - + "" + "" - + "VIRT_BASE" - + "3221225472" - + "" + "" - + "GUEST_VERSION" - + "2.6" - + "" + "" - + "PADDR_OFFSET" - + "" + "" - + "" + "" - + "GUEST_OS" - + "linux" - + "" + "" - + "HYPERCALL_PAGE" - + "3238010880" - + "" + "" - + "LOADER" - + "generic" - + "" + "" - + "SUSPEND_CANCEL" - + "" + "" - + "" + "" - + "PAE_MODE" - + "yes" - + "" + "" - + "ENTRY" - + "3242303488" - + "" + "" - + "XEN_VERSION" - + "xen-3.0" - + "" + "" - + "" + "" - + "expose_host_uuid" + "" - + "" + "" + "" - + "pci" + "" - + "" + "" + "" - + "superpages" + "" - + "" + "" + "" - + "nomigrate" + "" - + "" + "" + "" - + "" + "" + "cpus" - + "" + "" - + "" + "" - + "" + "" + "store_mfn" - + "873707" + "" - + "" + "uuid" + "" - + VMID - + "" - + "" - + "" - + "on_reboot" - + "restart" - + "" - + "" - + "state" - + "-b----" - + "" - + "" - + "cpu_weight" - + "27500" - + "" - + "" - + "online_vcpus" - + "" - + "" - + "" - + "" - + "memory" - + "512" - + "" - + "" - + "cpu_cap" - + "" - + "" - + "" - + "" - + "status" - + "" - + "" - + "" - + "" - + "pool_name" - + "Pool-0" - + "" - + "" - + "description" - + "" - + "" - + "" - + "start_time" - + "1408105444.17" - + "" - + "" - + "on_poweroff" - + "destroy" - + "" - + "" - + "on_xend_start" - + "ignore" - + "" - + "" - + "on_crash" - + "restart" - + "" - + "" - + "device" - + "" - + "" - + "vif" - + "" - + "" - + "" - + "bridge" - + ""+VMNICBR+"" - + "" - + "" - + "mac" - + ""+VMNICMAC+"" - + "" - + "" - + "script" - + "/etc/xen/scripts/vif-bridge" - + "" - + "" - + "uuid" - + ""+VMNICUUID+"" - + "" - + "" - + "backend" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "vkbd" - + "" - + "" - + "" - + "backend" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "console" - + "" - + "" - + "" - + "protocol" - + "vt100" - + "" - + "" - + "location" - + "" - + "" - + "" - + "" - + "uuid" - + "9beb5016-dde7-8526-491f-e972f262a634" - + "" - + "" - + "" - + "" - + "" - + "vfb" - + "" - + "" - + "" - + "vncunused" - + "" - + "" - + "" - + "" - + "vnc" - + "" - + "" - + "" - + "" - + "xauthority" - + "/root/.Xauthority" - + "" - + "" - + "vnclisten" - + "0.0.0.0" - + "" - + "" - + "vncpasswd" - + "7693f834ca67912e" - + "" - + "" - + "keymap" - + "en-us" - + "" - + "" - + "location" - + "0.0.0.0:5900" - + "" - + "" - + "uuid" - + "78edf954-e375-b142-9c76-791ce805b6ef" - + "" - + "" - + "" - + "" - + "" - + "vbd" - + "" - + "" - + "" - + "protocol" - + "x86_32-abi" - + "" - + "" - + "uuid" - + "bda35954-2596-025e-168c-b82e1cf92369" - + "" - + "" - + "bootable" - + "" - + "" - + "" - + "" - + "dev" - + "xvda:disk" - + "" - + "" - + "uname" - + "file:/OVS/Repositories/" - + REPOID - + "/VirtualDisks/" - + VMROOTDISK - + "" - + "" - + "" - + "mode" - + "" - + "" - + "" - + "" - + "VDI" - + "" - + "" - + "" - + "backend" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "" - + "bootloader" - + "/usr/bin/pygrub" - + "" - + "" - + "maxmem" - + "512" - + "" - + "" - + "cpu_time" - + "5.627111952" - + "" - + "" - + "shadow_memory" - + "" - + "" - + "" - + "" - + "name" - + "" - + VMNAME - + "" - + "" - + "" - + "builder" - + "linux" - + "" - + "" - + "bootloader_args" - + "-q" - + "" - + "" - + "domid" - + "" - + "" - + "" - + "" - + "vcpus" - + "" - + "" + "" + ""); - - public String getSingleVmConfigXML() { - return this.SINGLEVMCONFIGXML; - } - String SINGLEVMCONFIGXML = results - .simpleResponseWrapWrapper("" - + "" - + "vif" - + "" - + "mac="+VMNICMAC+",bridge="+VMNICBR+"" - + "mac=02:00:50:9a:00:02,bridge=xenbr0.240" - + "" + "" + "" - + "extra" + "" - + "" + "" + "OVM_simple_name" - + "" - + VMNAME - + "" - + "" - + "" - + "disk" - + "" - + "file:/OVS/Repositories/" - + REPOID - + "/VirtualDisks/" - + VMROOTDISK - + ",xvda,w" - + "" - + "" - + "" - + "bootargs" - + "" - + "" - + "" - + "uuid" - + "" - + VMID - + "" - + "" - + "" - + "on_reboot" - + "restart" - + "" - + "" - + "cpu_weight" - + "27500" - + "" - + "" - + "memory" - + "512" - + "" - + "" - + "cpu_cap" - + "0" - + "" - + "" - + "maxvcpus" - + "1" - + "" - + "" - + "OVM_high_availability" - + "0" - + "" - + "" - + "OVM_description" - + "" - + "" - + "" - + "on_poweroff" - + "destroy" - + "" - + "" - + "on_crash" - + "restart" - + "" - + "" - + "bootloader" - + "/usr/bin/pygrub" - + "" - + "" - + "guest_os_type" - + "Other.Linux" - + "" - + "" - + "name" - + "" - + VMNAME - + "" - + "" - + "" - + "vfb" - + "" - + "vncunused=1,vncpasswd=7693f834ca67912e,keymap=en-us,type=vnc,vnclisten=0.0.0.0" - + "" - + "" - + "" - + "vcpus" - + "1" - + "" - + "" - + "OVM_cpu_compat_group" - + "" - + "" - + "" - + "OVM_domain_type" - + "xen_pvm" - + "" - + ""); - - /* fix */ - @Test - public void testListVm() throws Ovm3ResourceException { - con.setResult(this.SINGLEVMLISTXML); - results.basicBooleanTest(xEn.listVm(REPOID, VMID)); - con.setResult(results.getNil()); - results.basicBooleanTest(xEn.listVm(REPOID, VMID), false); - } - - @Test - public void testGetRunningVmConfig() throws Ovm3ResourceException { - con.setResult(this.MULTIPLEVMSLISTXML); - Xen.Vm domU = xEn.getRunningVmConfig(VMNAME); - - /* only works from a live configuration */ - results.basicStringTest(domU.getVmRootDiskPoolId(), REPOID); - results.basicIntTest(domU.getVncPort(), 5900); - results.basicStringTest(domU.getVncAddress(), "0.0.0.0"); - } - - @Test - public void testGetVmConfig() throws Ovm3ResourceException { - con.setResult(this.SINGLEVMCONFIGXML); - Xen.Vm domU = xEn.getVmConfig(REPOID, VMID); - /* getVncPort doesn't work with live config due to a bug in the agent */ - // results.basicIntTest(domU.getVncPort(), 5900); - results.basicStringTest(domU.getVmName(), VMNAME); - results.basicIntTest(domU.getVifIdByMac(VMNICMAC), 0); - results.basicIntTest(domU.getVifIdByMac("02:00:50:9a:00:02"), 1); - results.basicIntTest(domU.getVifIdByMac("02:00:50:9a:00:03"), -1); - con.setResult(results.getNil()); - xEn.getVmConfig(REPOID, VMID); - - con.setResult(results.getNil()); - } - - @Test - public void testRebootVM() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(xEn.rebootVm(REPOID, VMID)); - results.basicBooleanTest(xEn.rebootVm(REPOID, VMID, 1)); - } - - @Test - public void testControlDomain() throws Ovm3ResourceException { - con.setResult(this.MULTIPLEVMSLISTXML); - Xen.Vm dom0 = xEn.getRunningVmConfig(DOM0VMNAME); - results.basicBooleanTest(dom0.isControlDomain(), true); - Xen.Vm domU = xEn.getRunningVmConfig(VMNAME); - results.basicBooleanTest(domU.isControlDomain(), false); - con.setResult(results.getNil()); - } - - @Test - public void testCreateVm() throws Ovm3ResourceException { - Xen.Vm domU = xEn.getVmConfig(); - domU.setVmCpus(1); - domU.setVmMemory(512); - domU.setVmDomainType("default"); - domU.setVmUuid(UUID.nameUUIDFromBytes(VMNAME.getBytes()).toString()); - domU.setVmName(VMNAME); - domU.addRootDisk(VMROOTDISK); - domU.setPrimaryPoolUuid(REPOID); - - domU.addVif(0, VMNICBR, VMNICMAC); - domU.addVif(0, "xenbr0.240", "02:00:50:9a:00:02"); - domU.removeVif("xenbr0.240", "02:00:50:9a:00:02"); - domU.setVnc("0.0.0.0", "gobbeldygoo"); - con.setResult(results.getNil()); - xEn.createVm(REPOID, VMID); - xEn.configureVmHa(REPOID, VMID, true); - xEn.startVm(REPOID, VMID); - - domU.addIso(VMISO); - domU.addIso(VMISO); - xEn.configureVm(REPOID, domU.getVmUuid()); - domU.removeDisk(VMISO); - domU.removeDisk("bogus"); - domU.getVmVifs(); - xEn.configureVm(REPOID, domU.getVmUuid()); - xEn.stopVm(REPOID, VMID, true); - - Xen.Vm domU2 = xEn.getVmConfig(); - domU2.setVmDomainType("hvm"); - domU2.addRootDisk(VMROOTDISK); - domU2.addDataDisk(VMROOTDISK); - domU2.getPrimaryPoolUuid(); - } - - @Test - public void testRemoveMissingVif() throws Ovm3ResourceException { - Xen.Vm domU = xEn.getVmConfig(); - domU.removeVif("xenbr0.240", "02:00:50:9a:00:02"); - } - - @Test - public void testVmDomainType() throws Ovm3ResourceException { - Xen.Vm domU = xEn.getVmConfig(); - domU.getVmDomainType(); - } - - @Test(expected = Ovm3ResourceException.class) - public void testMissingVncPort() throws Ovm3ResourceException { - Xen.Vm domU = xEn.getVmConfig(); - domU.getVncPort(); - } - - @Test - public void testVmCpusExceedsMaxVCPUs() throws Ovm3ResourceException { - Xen.Vm domU = xEn.getVmConfig(); - domU.setVmMaxCpus(2); - results.basicIntTest(domU.getVmMaxCpus(), 2); - domU.setVmCpus(4); - results.basicIntTest(domU.getVmCpus(), 2); - domU.setVmMaxCpus(12); - results.basicIntTest(domU.getVmCpus(), 2); - domU.setVmCpus(12); - results.basicIntTest(domU.getVmCpus(), 12); - domU.setVmMaxCpus(0); - results.basicIntTest(domU.getVmCpus(), 12); - } - - @Test - public void testStopVm() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(xEn.stopVm(REPOID, VMID)); - results.basicBooleanTest(xEn.stopVm(REPOID, VMID, true)); - } - - @Test - public void testPauseVm() throws Ovm3ResourceException { - con.setResult(results.getNil()); - results.basicBooleanTest(xEn.pauseVm(REPOID, VMID)); - } - - public String getMultipleVmsListXML() { - return MULTIPLEVMSLISTXML; - } - public String getVmName() { - return VMNAME; - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java deleted file mode 100644 index b175a164baa1..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/objects/XmlTestResultTest.java +++ /dev/null @@ -1,134 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.objects; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.List; - -import org.apache.commons.lang3.StringEscapeUtils; - -public class XmlTestResultTest { - private static final String NULL = ""; - - private String brack(String type, String s) { - return "<" + type + ">" + s + ""; - } - - public String escapeOrNot(String s) { - if (s.startsWith("<")) { - return StringEscapeUtils.escapeXml10(s); - } - return s; - } - - public String errorResponseWrap(String message) { - return errorResponseWrap(1, message); - } - - /* - * example exceptions.OSError:[Errno.17].File.exists: - * '/OVS/Repositories/f12842ebf5ed3fe78da1eb0e17f5ede8/VilualDisks/test.raw' - */ - public String errorResponseWrap(Integer faultCode, String message) { - String rs = "" + "" + "" - + "" + "" + "faultCode" - + "" + faultCode + "" + "" - + "" + "faultString" + "" - + message + "" + "" - + "" + "" + ""; - return rs; - } - - public String methodResponseWrap(String towrap) { - return "\n" + "\n" + "\n" - + towrap + "\n" + ""; - } - - public String simpleResponseWrapWrapper(String s) { - return methodResponseWrap("\n" + "" + s + "\n" - + "\n"); - } - - /* brack the entire wrap ? :) */ - public String simpleResponseWrap(String type, String s) { - if (type.contentEquals(NULL)) { - s = NULL; - } else { - s = brack(type, s); - } - return simpleResponseWrapWrapper(s); - } - - public String simpleResponseWrap(String s) { - return simpleResponseWrapWrapper(s); - } - - public String getBoolean(boolean bool) { - String b = "1"; - if (!bool) { - b = "0"; - } - return simpleResponseWrap("boolean", b); - } - - public String getString(String s) { - return simpleResponseWrap("string", s); - } - - public String getNil() { - return simpleResponseWrap(NULL, NULL); - } - - public void basicBooleanTest(boolean result) { - basicBooleanTest(result, true); - } - - public void basicBooleanTest(boolean result, boolean desired) { - assertNotNull(result); - assertEquals(desired, result); - } - - public void basicStringTest(String result, String desired) { - assertNotNull(result); - assertEquals(desired, result); - } - - public void basicIntTest(Integer result, Integer desired) { - assertNotNull(result); - assertEquals(desired, result); - } - - public void basicLongTest(Long result, Long desired) { - assertEquals(desired, result); - } - - public Boolean basicListHasString(List list, String x) { - for (String y : list) { - if (y.matches(x)) { - return true; - } - } - return false; - } - - public void basicDoubleTest(Double result, Double desired) { - assertEquals(desired, result); - } -} diff --git a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/support/Ovm3SupportTest.java b/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/support/Ovm3SupportTest.java deleted file mode 100644 index 8d9fb858af7a..000000000000 --- a/plugins/hypervisors/ovm3/src/test/java/com/cloud/hypervisor/ovm3/support/Ovm3SupportTest.java +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.hypervisor.ovm3.support; - -import java.util.Map; - -import javax.naming.ConfigurationException; - -import com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest; -import com.cloud.hypervisor.ovm3.objects.ConnectionTest; -import com.cloud.hypervisor.ovm3.objects.LinuxTest; -import com.cloud.hypervisor.ovm3.objects.NetworkTest; -import com.cloud.hypervisor.ovm3.objects.XenTest; -import com.cloud.hypervisor.ovm3.objects.XmlTestResultTest; -import com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorResource; -import com.cloud.hypervisor.ovm3.resources.Ovm3VirtualRoutingResource; -import com.cloud.hypervisor.ovm3.resources.helpers.Ovm3Configuration; -import com.cloud.hypervisor.ovm3.resources.helpers.Ovm3ConfigurationTest; - -public class Ovm3SupportTest { - ConnectionTest con = new ConnectionTest(); - XmlTestResultTest results = new XmlTestResultTest(); - NetworkTest net = new NetworkTest(); - LinuxTest linux = new LinuxTest(); - XenTest xen = new XenTest(); - CloudStackPluginTest csp = new CloudStackPluginTest(); - Ovm3HypervisorResource hypervisor = new Ovm3HypervisorResource(); - Ovm3VirtualRoutingResource virtualrouting = new Ovm3VirtualRoutingResource(); - Ovm3ConfigurationTest configTest = new Ovm3ConfigurationTest(); - - public ConnectionTest prepConnectionResults() { - ConnectionTest con = new ConnectionTest(); - con.setIp(con.getHostName()); - return configureResult(con); - } - - public Ovm3HypervisorResource prepare(Map params) throws ConfigurationException { - Ovm3Configuration config = new Ovm3Configuration(params); - con = prepConnectionResults(); - hypervisor.setConnection(con); - results.basicBooleanTest(hypervisor.configure(config.getAgentName(), - configTest.getParams())); - return hypervisor; - } - public ConnectionTest getConnection() { - return con; - } - - public ConnectionTest configureResult(ConnectionTest con) { - con.setMethodResponse("check_dom0_ip", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("ovs_ip_config", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("ovs_local_config", - results.simpleResponseWrap("string", "start")); - con.setMethodResponse("ovs_control_interface", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("update_server_roles", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("discover_network", - results.simpleResponseWrapWrapper(net.getDiscoverNetwork())); - con.setMethodResponse("discover_hardware", - results.simpleResponseWrapWrapper(linux.getDiscoverHw())); - con.setMethodResponse("discover_server", - results.simpleResponseWrapWrapper(linux.getDiscoverserver())); - con.setMethodResponse("discover_mounted_file_systems", - results.simpleResponseWrapWrapper(linux.getDiscoverFs())); - con.setMethodResponse("get_vncport", results.simpleResponseWrapWrapper("5900")); - con.setMethodResponse("echo", results.simpleResponseWrapWrapper("put")); - con.setMethodResponse("list_vms", xen.getMultipleVmsListXML()); - con.setMethodResponse("list_vm", xen.getSingleVmListXML()); - con.setMethodResponse("get_vm_config", xen.getSingleVmConfigXML()); - con.setMethodResponse("create_vm", results.getNil()); - con.setMethodResponse("start_vm", results.getNil()); - con.setMethodResponse("reboot_vm", results.getNil()); - con.setMethodResponse("stop_vm", results.getNil()); - con.setMethodResponse("configure_vm", results.getNil()); - con.setMethodResponse("migrate_vm", results.getNil()); - con.setMethodResponse("copy_file", results.getNil()); - con.setMethodResponse("storage_plugin_destroy", results.getNil()); - con.setMethodResponse("ping", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("check_domr_ssh", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("check_domr_port", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("exec_domr", csp.getDomrExecXml()); - con.setMethodResponse("ovs_domr_upload_file", - results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("ovs_domU_stats", (csp.getDomuStatsXml())); - con.setMethodResponse("check_dom0_status", (csp.getDom0StorageCheckXml())); - con.setMethodResponse("check_dom0_storage_health", results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("check_dom0_port", results.simpleResponseWrap("boolean", "1")); - con.setMethodResponse("check_dom0_storage_health_check", (csp.getDom0StorageCheckXml())); - return con; - } -} From 696c984e2947e82af0d4e0c411906dfbabd5eef2 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:52:35 +0200 Subject: [PATCH 07/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index df2b5a6f689e..8dc57c01ffed 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From fae47cac91d2c2b54d4a142989afc198835293c5 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:53:21 +0200 Subject: [PATCH 08/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 8dc57c01ffed..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 7240251916256bb1748fb7aebeb09c3c7765d14b Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:55:19 +0200 Subject: [PATCH 09/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index df2b5a6f689e..8dc57c01ffed 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 1a201bf7f16ee82fdb651234ee64d8e09c0430ff Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:56:33 +0200 Subject: [PATCH 10/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 8dc57c01ffed..5210cd27d16a 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 4048518e393685b11cc426db78889f6906019bdc Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 01:58:06 +0200 Subject: [PATCH 11/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 5210cd27d16a..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From e524706b3bd7eb88a8d1573e1fc91ccc9cd61385 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 02:00:40 +0200 Subject: [PATCH 12/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index df2b5a6f689e..8dc57c01ffed 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From 832397b46a5e9ab2be522173f9e107479c3399be Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 02:01:27 +0200 Subject: [PATCH 13/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 8dc57c01ffed..5210cd27d16a 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4 From cc7eac3e960d86336bd7564cf1da376feb6d73a7 Mon Sep 17 00:00:00 2001 From: Rafael da Fonseca Date: Mon, 8 Jun 2015 02:10:27 +0200 Subject: [PATCH 14/14] try another node --- plugins/hypervisors/ovm3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml index 5210cd27d16a..df2b5a6f689e 100644 --- a/plugins/hypervisors/ovm3/pom.xml +++ b/plugins/hypervisors/ovm3/pom.xml @@ -35,7 +35,7 @@ org.apache.commons commons-lang3 - 3.4 + 3.4