)

	BeforeEach(func() {
		softLayerClient = fakeslclient.NewFakeSoftLayerClient("fake-username", "fake-api-key")
		logger = boshlog.NewLogger(boshlog.LevelNone)

		finder = bm.NewBaremetalFinder(
			softLayerClient,
			logger,
		)
	})

	Describe("Find", func() {
		Context("succeeded", func() {
			BeforeEach(func() {
				testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Hardware_Service_getObject.json")
			})

			It("returns a new Softlayer Hardware without an error", func() {
				baremetal, err := finder.Find("fake-id")
				Expect(err).ToNot(HaveOccurred())
				Expect(baremetal.GlobalIdentifier).To(Equal("fake-id"))
				Expect(baremetal.BareMetalInstanceFlag).To(Equal(1))
				Expect(baremetal.ProvisionDate).ToNot(BeNil())
				Expect(baremetal.PrimaryIpAddress).To(Equal("1.1.1.1"))
			})
		})

		Context("failed", func() {
			BeforeEach(func() {
				testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Hardware_Service_getObject_None_Exist.json")
var _ = Describe("BaremetalCreator", func() {
	var (
		softLayerClient *fakeslclient.FakeSoftLayerClient
		logger          boshlog.Logger
		creator         bm.BaremetalCreator
	)

	BeforeEach(func() {
		softLayerClient = fakeslclient.NewFakeSoftLayerClient("fake-username", "fake-api-key")
		logger = boshlog.NewLogger(boshlog.LevelNone)

		creator = bm.NewBaremetalCreator(
			softLayerClient,
			logger,
		)
		testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Hardware_Service_createObject.json")
	})

	Describe("Create", func() {
		Context("succeeded", func() {
			It("returns a new Softlayer Hardware without an error", func() {
				baremetal, err := creator.Create(2, 1, 10, "fake-host", "fake-domain", "fake-os", "fake-data-center")
				Expect(err).ToNot(HaveOccurred())
				Expect(baremetal.GlobalIdentifier).To(Equal("fake-id"))
				Expect(baremetal.BareMetalInstanceFlag).To(Equal(0))
				Expect(baremetal.ProvisionDate).To(BeNil())
				Expect(baremetal.PrimaryIpAddress).To(Equal(""))
			})
		})

		Context("failed", func() {
var _ = Describe("SoftLayerFinder", func() {
	var (
		fc     *fakeclient.FakeSoftLayerClient
		logger boshlog.Logger
		finder SoftLayerFinder
	)

	BeforeEach(func() {
		fc = fakeclient.NewFakeSoftLayerClient("fake-user", "fake-key")
		logger = boshlog.NewLogger(boshlog.LevelNone)
		finder = NewSoftLayerDiskFinder(fc, logger)
	})

	Describe("Find", func() {
		It("returns disk and found as true when found the disk successfully", func() {
			testhelpers.SetTestFixtureForFakeSoftLayerClient(fc, "SoftLayer_Network_Storage_Service_getIscsiVolume.json")

			disk, found, err := finder.Find(1234)
			Expect(err).ToNot(HaveOccurred())
			Expect(found).To(BeTrue())

			expectedDisk := NewSoftLayerDisk(1234, fc, logger)
			Expect(disk).To(Equal(expectedDisk))
		})

		It("returns found as false when failed to find the disk", func() {
			testhelpers.SetTestFixtureForFakeSoftLayerClient(fc, "SoftLayer_Network_Storage_Service_getEmptyIscsiVolume.json")
			disk, found, err := finder.Find(1234)

			Expect(err).ToNot(HaveOccurred())
			Expect(found).To(BeFalse())
				"fake-network0": Network{
					Type:    "fake-type",
					IP:      "fake-IP",
					Netmask: "fake-Netmask",
					Gateway: "fake-Gateway",
					DNS: []string{
						"fake-dns0",
						"fake-dns1",
					},
					Default:         []string{},
					CloudProperties: map[string]interface{}{},
				},
			}

			vm = NewSoftLayerVM(1234567, softLayerClient, sshClient, agentEnvService, logger)
			testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Virtual_Guest_Service_getObject.json")
		})

		It("returns the expected network", func() {
			err := vm.ConfigureNetworks(networks)
			Expect(err).ToNot(HaveOccurred())
		})
	})

	Describe("#AttachDisk", func() {
		var (
			disk bsldisk.Disk
		)

		const expectedDmSetupLs1 = `
36090a0c8600058baa8283574c302c0fc-part1	(252:1)
	boshlog "github.com/cloudfoundry/bosh-utils/logger"

	fakesslclient "github.com/maximilien/softlayer-go/client/fakes"
)

var _ = Describe("SoftLayerFinder", func() {
	var (
		softLayerClient *fakesslclient.FakeSoftLayerClient
		logger          boshlog.Logger
		finder          SoftLayerFinder
	)

	BeforeEach(func() {
		softLayerClient = fakesslclient.NewFakeSoftLayerClient("fake-username", "fake-api-key")
		testhelpers.SetTestFixtureForFakeSoftLayerClient(softLayerClient, "SoftLayer_Account_Service_getVirtualDiskImages.json")

		logger = boshlog.NewLogger(boshlog.LevelNone)
		finder = NewSoftLayerFinder(softLayerClient, logger)
	})

	Describe("Find", func() {
		Context("valid stemcell ID pointing to a SL virtual disk image", func() {
			It("returns stemcell and found as true if stemcell ", func() {
				stemcell, found, err := finder.Find("8c7a8358-d9a9-4e4d-9345-6f637e10ccb7")
				Expect(err).ToNot(HaveOccurred())
				Expect(found).To(BeTrue())

				expectedStemcell := NewSoftLayerStemcell(4868344, "8c7a8358-d9a9-4e4d-9345-6f637e10ccb7", VirtualDiskImageKind, softLayerClient, logger)
				Expect(stemcell).To(Equal(expectedStemcell))
			})