AssertionHandleCommands := func() {
		JustBeforeEach(func() {
			By("init mqtt client")
			c, err := util.NewClient(tConfig.MqttBroker, app, uuid.NewV4().String())
			Expect(err).To(Succeed())
			client = c
		})

		AfterEach(func() {
			if client.IsConnected() {
				client.Disconnect(0)
			}

			By("Delete endnode after test")
			// Delete Endnode
			Expect(util.DeleteThing(app, user, enID)).To(Succeed())
		})

		It("Should success", func() {
			var (
				newVid string
				t      string
			)
			thingProperties := `{"_thingType":"LED"}`
			endnodeState := `{"power":true}`

			By("Get local token")
			t, _, err := util.LocalAuth(tConfig.GatewayAddress, app, "admin_user", "admin_pass")
			Expect(err).To(Succeed())
			Expect(t).ShouldNot(Equal(""))
		Expect(enID).NotTo(Equal(""))
		mEnID = enID
		mEnVID = enVid
		Expect(util.SaveEndnodApp(master, en, mUser, gwID, gwConfig.MasterApp.EndnodeAppsBackupBucket)).To(Succeed())
	})

	AfterEach(func() {
		if client.IsConnected() {
			client.Disconnect(0)
		}
		if client1.IsConnected() {
			client1.Disconnect(0)
		}

		// remove endnodes
		Expect(util.DeleteThing(master, mUser, mEnID)).To(Succeed())
		Expect(util.DeleteThing(en, eUser, eEnID)).To(Succeed())
	})

	It("Should Success", func() {
		By("Get local token of master app")
		t, _, err := util.LocalAuth(addr, master, "admin_user", "admin_pass")
		Expect(err).To(Succeed())
		Expect(t).NotTo(Equal(""))

		By("Onboard gateway")
		_, _, err = util.OnboardMasterApp(tConfig.GatewayAddress, t)
		Expect(err).NotTo(Succeed())

		By("Restore gateway")
		url := fmt.Sprintf("http://%s:%d/gateway-app/gateway/restore", addr.Host, addr.Port)