You can even get sneak attack on an opportunity attack later in the round because it's only limited to once per turn. Sneak attack is not an attack action, it's a triggered event based on its prerequisites.
Can you use green-flame blade and booming blade with Extra Attack, opportunity attacks, Sneak Attack, and other weapon attack options?
Introduced in the Sword Coast Adventurer’s Guide, the green-flame
blade and booming blade spells pose a number of questions, because
they each do something unusual: require you to make a melee attack
with a weapon as part of the spell’s casting. First, each of these
spells involves a normal melee weapon attack, not a spell attack, so
you use whatever ability modifier you normally use with the weapon. (A
spell tells you if it includes a spell attack, and neither of these
spells do.) For example, if you use a longsword with green-flame
blade, you use your Strength modifier for the weapon’s attack and
damage rolls.
Second, neither green-flame blade nor booming blade works with Extra
Attack or any other feature that requires the Attack action. Like
other spells, these cantrips require the Cast a Spell action, not the
Attack action, and they can’t be used to make an opportunity attack,
unless a special feature allows you to do so.
Third, these weapon attacks work with Sneak Attack if they fulfill the
normal requirements for that feature. For example, if you have the
Sneak Attack feature and cast greenflame blade with a finesse weapon,
you can deal Sneak Attack damage to the target of the weapon attack if
you have advantage on the attack roll and hit.
Best Answer
RAW supports both interpretations
Rules for spellcasting (emphasis mine):
I will use the standard form of propositional logic to pick the last sentence apart. Predicate logic shouldn't be used because RAW predicates nothing in the last sentence. Logicians enjoy, the terms I use and my rhetoric are for you.
The rest of the spell entry describes the spell's effect; or, if it is the rest of the spell entry, then it describes the spell's effect. The rest of the spell entry is a sufficient condition, the rest of the spell entry sufficiently describes the spell's effect. The spell's effect is a necessary condition, the spells effect is necessarily described by the rest of the spell entry. Being described by the rest of the spell entry does not sufficiently mean or imply that it is the spell's effect. It is left open whether things that are not the spell's effect can also be described within "the rest of the spell entry."
This means that while the rest of the spell entry describes the spell's effect, it doesn't necessarily disinclude the description of any other thing or occurrence. This is what concretes the argument Peter Cordez made in his answer, and a pillar which he used (he just didn't use philosophy of logic rhetoric).
This means that regarding RAW, there is absolutely no say whether any specific part contained within "the rest of a spell entry" is describing the spell's effect. It is only conclusive that the spell's effect is contained in that portion of the spell entry.
Booming blade:
The text in booming blade is open ended too, it says that the attack is made as part of the same action used to cast the spell, but it does not suggest that the attack is made as part of the spell. It also does not say that the attack is not part of the spell. If one were to use the same standard form of (propositional) logic they would find that booming blade makes no conclusion to whether the attack made is part of the spell, or spell's effect, or not.
Counterspell:
Counterspell causes a spell to fail and have no effect. But neither the rules for spellcasting, nor the description of booming blade, make any conclusion whether the attack made as part of casting booming blade is considered to be a part of the spell or its effect. Therefore, whether counterspell stops the attack from going through or not has no RAW ruling.
JC's ruling
An answer is most complete when in includes as much relevant material as possible. Although Jeremy Crawford's rulings are no longer considered official rulings, they were considered as such at one point. His rulings are quite relevant. Here is JC's tweet.
JC ruled that the attack is part of the spell's effect.