func (s *S) TestGetVirtualMachineByName(c *check.C) { client, _ := api.NewRPCClient("http://localhost:2633/RPC2", "oneadmin", "RaifZuewjoc4") vm := VirtualMachineReqs{VMName: "yeshapp", Client: client} res, error := vm.GetVirtualMachineByName() fmt.Println(res[0].Id) c.Assert(error, check.IsNil) }
func (s *S) TestCreate(c *check.C) { //oneadmin:yib4OquafUp1 client, _ := api.NewRPCClient("http://localhost:2633/RPC2", "oneadmin", "TaifZuewuijr4") vmObj := VirtualMachine{Name: "test", TemplateName: "sass", Cpu: "1", Memory: "1024", Image: "", Client: client, ContextMap: map[string]string{"assembly_id": "ASM-007", "assemblies_id": "AMS-007"}} //memory in terms of MB! duh! _, error := vmObj.Create() c.Assert(error, check.IsNil) }
func (s *S) TestGetTemplateByName(c *check.C) { client, _ := api.NewRPCClient("http://localhost:2633/RPC2", "oneadmin", "RaifZuewjoc4") flav := TemplateReqs{TemplateName: "newone", Client: client} res, error := flav.GetTemplateByName() fmt.Println(res[0].Id) c.Assert(error, check.IsNil) }